/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 21ms 660.0 KiB
#3 Accepted 26ms 796.0 KiB
#4 Accepted 27ms 952.0 KiB
#5 Accepted 69ms 5.566 MiB
#6 Accepted 73ms 5.668 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-10-03 13:30:46
Judged By
Score
100
Total Time
73ms
Peak Memory
5.668 MiB