/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 53ms 3.555 MiB
#3 Accepted 55ms 3.469 MiB
#4 Accepted 53ms 3.461 MiB
#5 Accepted 53ms 3.469 MiB
#6 Accepted 52ms 3.555 MiB
#7 Accepted 51ms 3.578 MiB
#8 Accepted 48ms 3.461 MiB
#9 Accepted 45ms 3.469 MiB
#10 Accepted 42ms 3.461 MiB
#11 Accepted 32ms 2.594 MiB
#12 Accepted 10ms 1.102 MiB

Code

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

#define ll unsigned long long
#define endl '\n'

void solve(int cs){
    int n;cin>>n;
    std::vector<pair<int,int>>v;
    vector<int>p;
    for(int i = 0; i < n; i++){
        int a;
        cin>>a;
        v.push_back({a,1e8});
    }
    int m;cin>>m;
    for(int i = 0; i < m; i++){
        int a;
        cin>>a;
        v.push_back({a,-i});
        p.push_back(a);
    }
    sort(v.rbegin(),v.rend());
    for(int i = 0; i < n+m; i++){
        if(v[i].second <= 0){
            p[abs(v[i].second)] = i+1;
        }
    }
    for(auto u:p)cout<<u<<" ";
}
   
int main()
{

    ios_base::sync_with_stdio(false);cin.tie(0);
    int t=1,cs=0;
    //cin >> t;
    while(t--)
    {
        solve(++cs);
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1049 Combined scoreboard
Contest
Brain Booster #3
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-06 15:50:30
Judged At
2024-11-11 03:33:48
Judged By
Score
100
Total Time
55ms
Peak Memory
3.578 MiB