/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 328.0 KiB
#2 Accepted 17ms 532.0 KiB
#3 Accepted 19ms 908.0 KiB
#4 Accepted 19ms 788.0 KiB
#5 Accepted 32ms 1.805 MiB
#6 Accepted 60ms 1.883 MiB

Code

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define all(a) a.begin(),a.end()
#define endl '\n'
 typedef pair<int, int> pi; 

void solve()
{
   ll n;cin>>n;
    priority_queue<pi, vector<pi>, greater<pi> > v;
ll x;
   for(ll i=0;i<n;i++)
   {
    cin>>x;
    v.push({x,i+1});
   }
   ll m;cin>>m;
   while(m--)
   {
    cin>>x;ll j=v.top().second;
    cout<<v.top().second<<endl;
    v.pop();
    v.push({x,j});
   }


}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    ll t=1;//cin>>t;
    while(t--)
    {
      solve();
    }    
}

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:46:00
Judged At
2024-08-16 15:46:00
Judged By
Score
100
Total Time
60ms
Peak Memory
1.883 MiB