/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 18ms 616.0 KiB
#3 Accepted 24ms 924.0 KiB
#4 Accepted 22ms 752.0 KiB
#5 Accepted 36ms 3.535 MiB
#6 Accepted 37ms 3.473 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-11-11 03:18:01
Judged By
Score
100
Total Time
37ms
Peak Memory
3.535 MiB