/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 187ms 724.0 KiB
#3 Accepted 200ms 940.0 KiB
#4 Accepted 194ms 972.0 KiB
#5 Accepted 255ms 7.129 MiB
#6 Accepted 262ms 7.195 MiB

Code

// #include <bits/stdc++.h>
// #define int long long
// #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
// #define YN(ans) ans?cout<<"YES"<<endl:cout<<"NO"<<endl;
// #define vin(a,n) vector<int>a(n);for(auto &x:a)cin>>x;
// #define st(v,x) x==0?sort(v.begin(),v.end()):sort(v.rbegin() , v.rend());
// #define vout(a) for(auto x:a){cout<<x<<' ';}cout<<"\n";
// using namespace std;
// const int mod=1e9+7;
// struct node{
//     int b,r,g,y;
// };

// void solved_by_RAFIQ(){
//     int n,m;cin>>n>>m;
//     vector<node>vs(n+1);
//     vector<string>vss(n+1);
//     vs[0].b=vs[0].r=vs[0].g=vs[0].y=0;
//     map<pair<char,int>,int>mpb;
//     vector<vector<int>>vv(n+1);
//     for(int i=0;i<n;i++){
//         string s;cin>>s;vss[i+1]=s;
//         vs[i+1].b=vs[i].b+s.find("B")?1:0;
//         vs[i+1].r=vs[i].r+s.find("R")?1:0;
//         vs[i+1].g=vs[i].g+s.find("G")?1:0;
//         vs[i+1].y=vs[i].y+s.find("Y")?1:0;
//         // vv[i+1][s[0]]=vv[i][s[0]]+
//         if(vs[i+1].b>vs[i].b)mpb[{'B',vs[i+1].b}]=i;
//         if(vs[i+1].r>vs[i].r)mpb[{'R',vs[i+1].r}]=i;
//         if(vs[i+1].g>vs[i].g)mpb[{'G',vs[i+1].g}]=i;
//         if(vs[i+1].y>vs[i].y)mpb[{'Y',vs[i+1].y}]=i;
//     }
//     while(m--){
//         int x,y;cin>>x>>y;
//         int ans=-1;
//         for(int i=1;i<3;i++){
//             if(mpb[{vss[x][i-1],}])
//         }
//     }

// }


// signed main(){
//     fastio
//     int test_case=1,n=1;cin>>test_case;
//     while (test_case--){
//         //cout<< "Case "<<n<<": ";n++;
//         solved_by_RAFIQ();
//     }
// }

#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define YN(ans) ans?cout<<"YES"<<endl:cout<<"NO"<<endl;
#define vin(a,n) vector<int>a(n);for(auto &x:a)cin>>x;
#define st(v,x) x==0?sort(v.begin(),v.end()):sort(v.rbegin() , v.rend());
#define vout(a) for(auto x:a){cout<<x<<' ';}cout<<"\n";
using namespace std;
const int mod=1e9+7;

void solved_by_RAFIQ(){
    int n;cin>>n;
    set<pair<int,int>>sp;
    for(int i=1;i<=n;i++){
        int x;cin>>x;sp.insert({x,i});
    }
    int q;cin>>q;
    while(q--){
        int x;cin>>x;
        int e,a;
        for(auto it:sp){
            e=it.second;a=it.first;
            cout << it.second <<endl;break;
        }
        sp.erase({a,e});
        sp.insert({x,e});
    }
}


signed main(){
    fastio
    int test_case=1,n=1;//cin>>test_case;
    while (test_case--){
        //cout<< "Case "<<n<<": ";n++;
        solved_by_RAFIQ();
    }
}

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 17:32:50
Judged At
2024-10-03 13:21:36
Judged By
Score
100
Total Time
262ms
Peak Memory
7.195 MiB