/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 16ms 576.0 KiB
#3 Accepted 18ms 788.0 KiB
#4 Accepted 19ms 920.0 KiB
#5 Accepted 42ms 1.883 MiB
#6 Accepted 68ms 1.883 MiB

Code

#include <bits/stdc++.h>
using namespace std;

#define all(v) v.begin(), v.end()

using LL = long long;

int main() {
  cin.tie (nullptr) -> ios_base :: sync_with_stdio (false);

  int tests = 1;
  // cin >> tests;
  while (tests--) {
    int n;
    cin >> n;
    priority_queue < pair <int, int>, vector < pair <int, int> >, greater < pair <int, int> > > pq;
    for (int i = 1; i <= n; i++) {
      int x;
      cin >> x;
      pq.push ({x, i});
    } 
    int q;
    cin >> q;
    while (q--) {
      int x;
      cin >> x;
      auto u = pq.top ();
      pq.pop ();
      cout << u.second << '\n';
      u.first = x;
      pq.push (u);
    }
    while (!pq.empty ()) pq.pop ();
  }

  return 0;
}

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 18:56:23
Judged At
2024-08-16 18:56:23
Judged By
Score
100
Total Time
68ms
Peak Memory
1.883 MiB