/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Accepted 38ms 708.0 KiB
#3 Accepted 42ms 904.0 KiB
#4 Accepted 49ms 880.0 KiB
#5 Accepted 114ms 5.652 MiB
#6 Accepted 111ms 5.559 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;
        for (auto [value,indx] : mp) {
            int store = indx;
            cout << indx << endl;
            mp.erase(value);
            mp[a] = store;
            break;
        }
    }
    
    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 16:18:44
Judged At
2024-10-03 13:27:33
Judged By
Score
100
Total Time
114ms
Peak Memory
5.652 MiB