/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 1.762 MiB
#2 Accepted 24ms 532.0 KiB
#3 Accepted 27ms 836.0 KiB
#4 Accepted 30ms 896.0 KiB
#5 Accepted 71ms 5.656 MiB
#6 Accepted 81ms 5.59 MiB

Code

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

#define ll long long
#define endl '\n'

int32_t main()
{   
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n; cin >> n;
    map<int,int>mp;
    for (int i = 1; i <= n; i++) {
        int x; cin >> x;
        mp[x] = i;
    }

    int q; cin >> q;
    while(q--) {
        int a; cin >> a;
        auto it = mp.begin();
        int value = (*it).first;
        int indx = (*it).second;
        int store = indx;
        cout << indx << endl;
        mp.erase(value);
        mp[a] = store;
    }

    return 0;
} 

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-19 22:05:05
Judged At
2024-08-19 22:05:05
Judged By
Score
100
Total Time
81ms
Peak Memory
5.656 MiB