/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Wrong Answer 169ms 11.469 MiB
#3 Wrong Answer 169ms 11.492 MiB

Code

#include<bits/stdc++.h>
using namespace  std;
using ll = long long;
 
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    int n; cin >> n;
    set<int> a;
    vector<int> c;
    for(int i = 0; i < n; i++) {
        int x; cin >> x;
        a.insert(x);
        c.push_back(x);
    }

    int m; cin >> m;
    vector<int> b(m);
    for(int i = 0; i < m; i++) {
        cin >> b[i];
        c.push_back(b[i]);
    }

    sort(c.rbegin(), c.rend());


    multimap<int, int> mp;
    vector<bool> ok(n + 1, false);

   for(int k = 0; k < c.size(); k++) {
    if (a.find(c[k]) != a.end() && !ok[c[k]]) {
        ok[c[k]] = true;
    } else {
        mp.emplace(c[k], k+1);
    }
}

for(int i = 0; i < m; i++) {
    auto it = mp.find(b[i]);
    cout << it->second << ' ';
    mp.erase(it);
}


    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 17:53:26
Judged At
2024-11-11 03:31:48
Judged By
Score
5
Total Time
169ms
Peak Memory
11.492 MiB