/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 21ms 580.0 KiB
#3 Accepted 27ms 956.0 KiB
#4 Accepted 28ms 880.0 KiB
#5 Accepted 70ms 5.578 MiB
#6 Accepted 75ms 5.598 MiB

Code

// @sagorahmedmunna

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

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  
  int n;
  cin >> n;
  set<array<int, 2>> st;
  for (int i = 1; i <= n; i++) {
    int ai;
    cin >> ai;
    st.insert({ai, i});
  }
  int q;
  cin >> q;
  while (q--) {
    int val;
    cin >> val;
    auto [v, i] = *st.begin();
    cout << i << '\n';
    st.erase(st.begin());
    st.insert({val, i});
  }
  return 0;
}

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:38:58
Judged At
2024-11-11 03:18:16
Judged By
Score
100
Total Time
75ms
Peak Memory
5.598 MiB