/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Wrong Answer 209ms 824.0 KiB
#3 Wrong Answer 217ms 1.02 MiB

Code

#include <bits/stdc++.h>
using namespace std;
int slv_by_payel(int n)
{
    vector<int> samp(n); 
    int min = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> samp[i];
        if (samp[i] < samp[min])
        {
            min = i;
        }
    }
    
    int q;
    cin >> q;

    while (q--) 
    {
        int x;
        cin >> x;
        
        cout << min + 1 << endl;
        
        samp[min] = x;

        if (x < samp[min])
        {
            min = min_element(samp.begin(), samp.end()) - samp.begin();
        }
        else
        {
            if (min < n - 1 && samp[min + 1] < samp[min])
            {
                min = min_element(samp.begin(), samp.end()) - samp.begin();
            }
        }
    }
    return 0;
}
int main()
{
    //int tc;
    //cin>>tc;
    //while(tc--)
    //{
        int n;
        cin>>n;
        slv_by_payel(n);
    //    cout<<reslt<<endl;
    //}
 
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Contest
Bangladesh 2.0
Language
C++17 (G++ 13.2.0)
Submit At
2024-08-16 17:42:33
Judged At
2024-11-11 03:11:05
Judged By
Score
10
Total Time
217ms
Peak Memory
1.02 MiB