/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 332.0 KiB
#2 Accepted 29ms 844.0 KiB
#3 Accepted 36ms 856.0 KiB
#4 Accepted 32ms 1.137 MiB
#5 Accepted 64ms 1.883 MiB
#6 Accepted 65ms 1.949 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-10-03 13:20:17
Judged By
Score
100
Total Time
65ms
Peak Memory
1.949 MiB