/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 18ms 536.0 KiB
#3 Accepted 22ms 752.0 KiB
#4 Accepted 22ms 780.0 KiB
#5 Accepted 43ms 1.781 MiB
#6 Accepted 42ms 1.988 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-11-11 03:10:32
Judged By
Score
100
Total Time
43ms
Peak Memory
1.988 MiB