/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 3ms 488.0 KiB
#2 Accepted 176ms 744.0 KiB
#3 Accepted 178ms 1.113 MiB
#4 Accepted 194ms 1000.0 KiB
#5 Accepted 243ms 7.215 MiB
#6 Accepted 286ms 7.215 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-11-11 03:17:53
Judged By
Score
100
Total Time
286ms
Peak Memory
7.215 MiB