QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#343292#8243. Contest AdvancementMayaZayn#WA 1ms3628kbC++141.9kb2024-03-02 13:32:392024-03-02 13:32:40

Judging History

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

  • [2024-03-02 13:32:40]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3628kb
  • [2024-03-02 13:32:39]
  • 提交

answer

#include <bits/stdc++.h>
#define MayaZayn ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define all_r(x) (x).rbegin(), (x).rend()
#define mnEl(vec) *min_element(vec.begin(), vec.end())
#define mxEl(vec) *max_element(vec.begin(), vec.end())
#define yes cout << "YES"
#define no cout << "NO"
#define in(v) for (auto & x : v) cin >> x
#define out(v) for (auto & x : v) cout << x << ' '
#define inLL(v) for (ll & x : v) cin >> x
#define openIn(x) freopen(x, "r", stdin);
#define openOut(x) freopen(x, "w", stdout);
#define M 1000000007
#define N 100005

using namespace std;

void solve() {
    int n, k, c;
    cin >> n >> k >> c;
    vector<int> v(N, 0), b, a;

    for (int i = 0; i < n; ++i) {
        int t, s;
        cin >> t >> s;
        b.push_back(t);
        if (v[s] < c) {
            v[s]++;
            a.push_back(t);
        }
    }

    if (a.size() < k) {
        for (int i = 0; i < k; ++i) {
            cout << b[i] << endl;
        }
    } else {
        for (int i = 0; i < k; ++i) {
            cout << a[i] << endl;
        }
    }
}

int main() {
    MayaZayn

//    int t;
//    cin >> t;
//    while (t--)
    solve();

    return 0;
}




//        int i = 0, j = 0;
//        while (i < a.size() && j < b.size() && k) {
//            if (a[i].second > b[j].second) {
//                cout << a[i].first << endl;
//                i++;
//            } else {
//                cout << b[j].first << endl;
//                j++;
//            }
//            k--;
//        }
//
//        while (i < a.size() && k) {
//            cout << a[i].first << endl;
//            i++;
//            k--;
//        }
//
//        while (j < b.size() && k) {
//            cout << b[j].first << endl;
//            j++;
//            k--;
//        }

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3628kb

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: 1ms
memory: 3584kb

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

result:

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