/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 328.0 KiB
#2 Wrong Answer 53ms 3.016 MiB

Code

#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define endl '\n'
#define Endl '\n'

using namespace std;

const int N = 2e5 + 5;
int tc, n, m;
vector<pair<int, int>> results;

bool cmp(pair<int, int> a, pair<int, int> b) {
    if (a.F == b.F) {
        return a.S < b.S;
    } else {
        return a.F > b.F;
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); // cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        results.push_back({x, -1});
    }
    cin >> m;
    for (int i = 1; i <= m; i++) {
        int x;
        cin >> x;
        results.push_back({x, i});
    }

    vector<int> Ans(m);
    int cnt = 0;
    sort(results.begin(), results.end(), cmp);
    for (auto i : results) {
        ++cnt;
        if (i.S != -1) {
            Ans[i.S - 1] = cnt;
        }
    }
    for (auto i : Ans) {
        cout << i << " ";
    }
    cout << endl;

    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:30:33
Judged At
2024-11-11 03:34:11
Judged By
Score
0
Total Time
53ms
Peak Memory
3.016 MiB