/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 324.0 KiB
#2 Accepted 32ms 672.0 KiB
#3 Accepted 36ms 964.0 KiB
#4 Accepted 35ms 912.0 KiB
#5 Accepted 56ms 1.906 MiB
#6 Accepted 59ms 1.836 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-10-03 13:30:03
Judged By
Score
100
Total Time
59ms
Peak Memory
1.906 MiB