/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 22ms 580.0 KiB
#3 Accepted 28ms 916.0 KiB
#4 Accepted 27ms 932.0 KiB
#5 Accepted 94ms 5.527 MiB
#6 Accepted 75ms 5.672 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-08-16 16:18:44
Judged By
Score
100
Total Time
94ms
Peak Memory
5.672 MiB