/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 21ms 540.0 KiB
#3 Accepted 26ms 796.0 KiB
#4 Accepted 25ms 848.0 KiB
#5 Accepted 77ms 7.203 MiB
#6 Accepted 108ms 7.055 MiB

Code

/**
 *  written by Binoy Barman .
**/

#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
#define all(v) v.begin(), v.end()
#define Too_Many_Jobs int tts, tc = 1; cin >> tts; hell: while(tts--)
#define Dark_Lord_Binoy ios_base::sync_with_stdio(false); cin.tie(NULL);

#ifdef LOCAL
#include "unravel.hpp"
#else
#define dbg(...) 42
#endif
#define int long long

int32_t main() {
Dark_Lord_Binoy
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    multiset<pair<int, int>> a;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a.insert({x, i + 1});
    }
    int q;
    cin >> q;
    while(q--) {
        int pos = (*(a.begin())).second;
        cout << pos << nl;
        auto it = a.begin();
        a.erase(it);
        int x;
        cin >> x;
        a.insert({x, pos});
    }

    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:42:13
Judged At
2024-08-16 15:42:13
Judged By
Score
100
Total Time
108ms
Peak Memory
7.203 MiB