/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 218ms 732.0 KiB
#3 Accepted 220ms 884.0 KiB
#4 Accepted 220ms 952.0 KiB
#5 Accepted 302ms 7.898 MiB
#6 Accepted 316ms 7.957 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-11-11 03:15:47
Judged By
Score
100
Total Time
316ms
Peak Memory
7.957 MiB