/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 18ms 760.0 KiB
#3 Accepted 22ms 804.0 KiB
#4 Accepted 22ms 792.0 KiB
#5 Accepted 35ms 3.457 MiB
#6 Accepted 37ms 3.406 MiB

Code

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 2e5 + 10;
const ll MOD = 1e9 + 7;

void solve()
{
  ll n;
  cin >> n;
  
  vector<ll> v(n);
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>> > pq;
  for(ll i = 0; i < n; i++) {
    cin >> v[i];
    pq.push({v[i], i + 1});
  }
  
  ll q;
  cin >> q;
  while(q--) {
    ll p;
    cin >> p;
    auto temp = pq.top();
    pq.pop();
    cout << temp.second << "\n";
    pq.push({p, temp.second});
  }
}

int main()
{
  ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
  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:41:25
Judged At
2024-10-03 13:30:32
Judged By
Score
100
Total Time
37ms
Peak Memory
3.457 MiB