/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 324.0 KiB
#2 Wrong Answer 59ms 4.871 MiB

Code

// بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
// In the Name of Allah, the Beneficent, the Merciful.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define vi vector<int>
#define vl vector<long long>
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define inv(a) for(auto &it : a) cin >> it;
#define outv(a) for(auto &it : a) cout << it << " ";cout<<"\n"
#define outv1(a) for(auto &it : a) cout << it << "\n";cout<<"\n"
#define pb push_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define inf 1e9
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define int long long

bool cmp(const pair<int, int>& a, const pair<int, int>& b) {
    if(a.first==b.first) return a.second>b.second;
    return a.first < b.first;
}

void solve(int tc) {
    int n;
    cin>>n;
    vector<pair<int,int>> v;
    for (int i = 0; i < n; i++) {
        int x; cin>>x;
        v.pb({x,-1});
    }
    int m; cin>>m;
    for (int i = 0; i < m; i++) {
        int x; cin>>x;
        v.pb({x,i});
    }
    sort(rall(v), cmp);
    vl ans(m, 0);
    for (int i = 0; i < v.size(); i++) {
        if(v[i].S==-1) continue;
        ans[v[i].S]=i+1;
    }
    outv(ans);
}

int32_t main() {
    fastio;
    int tc=1;
    // cin>>tc;
    for (int i = 1; i <= tc; i++) {
        solve(i);
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1049 Combined scoreboard
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-08 09:27:28
Judged At
2024-11-11 03:30:39
Judged By
Score
0
Total Time
59ms
Peak Memory
4.871 MiB