/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 20ms 624.0 KiB
#3 Accepted 25ms 748.0 KiB
#4 Accepted 25ms 904.0 KiB
#5 Accepted 66ms 5.508 MiB
#6 Accepted 73ms 5.562 MiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nl '\n'



void solve()
{
    
    int n ; cin>> n ;
    int aa[n+5];
    set<pair<int,int>> s ;
    for(int i=1 ; i<=n ; i++){
        int x ; cin>> x ;
        pair<int,int> xx ;
        xx = {x , i};
        s.insert(xx);
    }
    int q ; cin>> q ;
    while(q--){
        int x ; cin>> x ;
        auto it = s.begin();
        int temp = it->second;
        cout<< it->second << nl;
        pair<int,int> xx ;
        xx = {x,temp};
        s.erase(it);
        s.insert(xx);
    }
    
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    
        solve() ;
    
}

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Contest
Bangladesh 2.0
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 15:46:33
Judged At
2024-10-03 13:30:01
Judged By
Score
100
Total Time
73ms
Peak Memory
5.562 MiB