Accepted
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