/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 344.0 KiB
#2 Accepted 38ms 664.0 KiB
#3 Accepted 45ms 812.0 KiB
#4 Accepted 45ms 992.0 KiB
#5 Accepted 110ms 5.66 MiB
#6 Accepted 120ms 5.699 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-11-11 03:15:09
Judged By
Score
100
Total Time
120ms
Peak Memory
5.699 MiB