/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 46ms 824.0 KiB
#3 Accepted 47ms 784.0 KiB
#4 Accepted 61ms 980.0 KiB
#5 Accepted 127ms 5.852 MiB
#6 Accepted 121ms 5.695 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-11-11 03:07:02
Judged By
Score
100
Total Time
127ms
Peak Memory
5.852 MiB