QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#593238#8243. Contest Advancementenze#WA 0ms3752kbC++201.1kb2024-09-27 12:51:182024-09-27 12:51:19

Judging History

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

  • [2024-09-27 12:51:19]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3752kb
  • [2024-09-27 12:51:18]
  • 提交

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

    for(int i = 0; i < a.size(); i++){
        if(rec[i] != 1 && k){
            cout << a[i][0] << endl;
            k--;
        }
    }
}

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: 3584kb

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: 3752kb

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
10
3
4

result:

wrong answer 3rd lines differ - expected: '3', found: '10'