/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 188ms 672.0 KiB
#3 Accepted 198ms 960.0 KiB
#4 Accepted 197ms 964.0 KiB
#5 Accepted 304ms 7.941 MiB
#6 Accepted 331ms 7.855 MiB

Code

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n;
    cin >> n;
    int a[n];
    for(int &i:a) cin >> i;
    set<pair<int, int>>s;
    for(int i = 0; i < n; i++) s.insert({a[i], i});
    int q;
    cin >> q;
    while(q--){
        int x;
        cin >> x;
        pair<int, int> p = *s.begin();
        s.erase(s.begin());
        s.insert({x,p.second});
        cout << p.second + 1 << endl;
    }
    return 0;
}

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 16:10:39
Judged At
2024-10-03 13:28:18
Judged By
Score
100
Total Time
331ms
Peak Memory
7.941 MiB