/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 18ms 596.0 KiB
#3 Accepted 22ms 940.0 KiB
#4 Accepted 22ms 848.0 KiB
#5 Accepted 34ms 2.0 MiB
#6 Accepted 35ms 1.965 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-11-11 03:17:29
Judged By
Score
100
Total Time
35ms
Peak Memory
2.0 MiB