/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 72ms 3.68 MiB
#3 Accepted 72ms 3.672 MiB
#4 Accepted 72ms 3.594 MiB
#5 Accepted 72ms 3.68 MiB
#6 Accepted 71ms 3.684 MiB
#7 Accepted 70ms 3.68 MiB
#8 Accepted 66ms 3.59 MiB
#9 Accepted 63ms 3.672 MiB
#10 Accepted 60ms 3.59 MiB
#11 Accepted 43ms 2.391 MiB
#12 Accepted 14ms 1.133 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-11-11 03:34:31
Judged By
Score
100
Total Time
72ms
Peak Memory
3.684 MiB