Accepted
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll md = 1e9+7;
void solve() {
set<pair<ll,int>>st;
int n;
cin>>n;
for(int i=1;i<=n;i++){
ll x;cin>>x;
st.insert({x,i});
}
int q;
cin>>q;
while(q--){
ll x;
cin>>x;
auto it=st.begin();
cout<<(*it).second<<endl;
ll y=(*it).second;
ll xy=(*it).first;
st.erase({xy,y});
st.insert({x,y});
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int T;
T=1;//cin >> T;
while (T--) {
solve();
}
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 15:42:31
- Judged At
- 2024-11-11 03:17:53
- Judged By
- Score
- 100
- Total Time
- 286ms
- Peak Memory
- 7.215 MiB