/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 190ms 740.0 KiB
#3 Accepted 203ms 992.0 KiB
#4 Accepted 205ms 984.0 KiB
#5 Accepted 271ms 7.023 MiB
#6 Accepted 276ms 7.293 MiB

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-10-03 13:30:26
Judged By
Score
100
Total Time
276ms
Peak Memory
7.293 MiB