QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#593280#8243. Contest Advancementenze#WA 0ms3620kbC++201.1kb2024-09-27 13:04:082024-09-27 13:04:09

Judging History

你现在查看的是最新测评结果

  • [2024-09-27 13:04:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2024-09-27 13:04:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define pb push_back

const ld pi = 3.14159265358979323846;
const int mod = (int)1e9 + 7;
const ll INF = 1e18;

template<typename T>
T chmax(T a, T b) {
    return a > b ? a : b;
}

template<typename T>
T chmin(T a, T b) {
    return a > b ? b : a;
}

const int N = (int)2e5 + 1, M = N * 2;

void solve(){
    int n, k, c;
    cin >> n >> k >> c;

    map<int, int> mp, rec;
    vector<vector<int>> a, b;

    for(int i = 0; i < n; i++){
        int s, t;
        cin >> s >> t;
        a.pb({s, t});
        if(mp[t] >= c || k <= 0) continue;
        b.pb({i, s});
        rec[i] = 1;
        mp[t]++;
        k--;
    }

    for(int i = 0; i < a.size(); i++){
        if(rec[i] != 1 && k){
            b.pb({i, a[i][0]});
        }
    }

    sort(b.begin(), b.end());
    for(auto e : b) cout << e[1] << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(0);

    int t = 1;
    // cin >> t; 

    while(t--){
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

10 7 3
3 9
1 9
4 9
5 9
9 7
2 7
6 7
7 7
8 5
10 5

output:

3
1
4
9
2
6
8

result:

ok 7 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3552kb

input:

10 5 2
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 2

output:

1
2
3
4
5
6
7
8
9
10

result:

wrong answer 5th lines differ - expected: '10', found: '5'