/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 48ms 2.883 MiB
#3 Accepted 48ms 2.867 MiB
#4 Accepted 48ms 3.039 MiB
#5 Accepted 47ms 3.062 MiB
#6 Accepted 48ms 3.055 MiB
#7 Accepted 47ms 2.953 MiB
#8 Accepted 46ms 2.898 MiB
#9 Accepted 45ms 3.082 MiB
#10 Accepted 43ms 2.953 MiB
#11 Accepted 28ms 2.297 MiB
#12 Accepted 9ms 936.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
const long long M=2e5+10,MOD=1000000007;
typedef long long ll;
bool cmp(pair<int,int>x,pair<int,int>y){
    if(x.first!=y.first){
        return x.first>y.first;
    }
    else return x.second<y.second;
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n;
    vector<pair<int,int>>v;
    for(int i=1;i<=n;i++){
        int a;
        cin>>a;
        v.push_back({a,i});
       
    }
    cin>>m;
    for(int i=1;i<=m;i++){
        int a;
        cin>>a;
        v.push_back({a,i+n});
    }
    sort(v.begin(),v.end(),cmp);
    vector<int>res(m+1,0);
    int pos=1;
    for(auto it:v){
        if(it.second>n)res[it.second-n]=pos;
        pos++;
       // cout<<it.first<<" "<<it.second<<"\n";
    }
    for(int i=1;i<=m;i++)cout<<res[i]<<" ";




    
   
   return 0;
 
}

Information

Submit By
Type
Submission
Problem
P1049 Combined scoreboard
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-02 16:56:28
Judged At
2024-05-02 16:56:28
Judged By
Score
100
Total Time
48ms
Peak Memory
3.082 MiB