/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 52ms 3.184 MiB
#3 Accepted 52ms 3.086 MiB
#4 Accepted 52ms 3.082 MiB
#5 Accepted 51ms 3.082 MiB
#6 Accepted 52ms 3.172 MiB
#7 Accepted 51ms 3.086 MiB
#8 Accepted 47ms 3.105 MiB
#9 Accepted 45ms 3.094 MiB
#10 Accepted 42ms 3.082 MiB
#11 Accepted 30ms 2.289 MiB
#12 Accepted 9ms 1.016 MiB

Code

#include <bits/stdc++.h>
 
typedef long long ll;
using namespace std;

void solve(){
    int n, m; cin>>n;//>>m;
    //cout<<n<<m<<"\n";
    vector<pair<int, int>> v;
    for(int i=0; i<n; i++){
        int x; cin>>x;
        v.push_back({-x, 0});
    }
    cin>>m;
    for(int i=0; i<m; i++){
        int x; cin>>x;
        v.push_back({-x, i+1});
    }

    int pos[m+1];

    sort(v.begin(), v.end());

    //for(auto p: v) cout<<p.first<<" "<<p.second<<"\n";

    for(int i=0; i<n+m; i++){
        pos[v[i].second] = i+1;
    }

    for(int i=1; i<=m; i++){
        cout<<pos[i]<<" ";
    }

    //cout<<"\n";

    return;

}

int main(){   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t=1; //cin>>t;

    while(t--){
        solve();
    }

    return 0;

}
 

Information

Submit By
Type
Submission
Problem
P1049 Combined scoreboard
Contest
Brain Booster #3
Language
C++17 (G++ 13.2.0)
Submit At
2024-05-06 15:24:05
Judged At
2024-10-03 13:52:12
Judged By
Score
100
Total Time
52ms
Peak Memory
3.184 MiB