Accepted
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