Accepted
Code
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n;
cin>>n;
vector<int> arr(n);
set<pair<int,int>> s;
for (int i = 0; i < n; ++i) {
cin >> arr[i];
s.insert({arr[i], i});
}
int q;
cin >> q;
while (q--) {
int x;
cin >> x;
auto minElem=*s.begin();
int minPos=minElem.second;
cout << minPos + 1 << endl;
s.erase(s.begin());
s.insert({x, minPos});
arr[minPos] = x;
}
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 16:15:30
- Judged At
- 2024-10-03 13:27:54
- Judged By
- Score
- 100
- Total Time
- 323ms
- Peak Memory
- 6.035 MiB