QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#343262#8243. Contest AdvancementMayaZayn#WA 1ms3668kbC++141.2kb2024-03-02 12:26:472024-03-02 12:26:48

Judging History

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

  • [2024-03-02 12:26:48]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3668kb
  • [2024-03-02 12:26:47]
  • 提交

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), a;

    for (int i = 0; i < n; ++i) {
        int t, s;
        cin >> t >> s;
        if (v[s] < c && k) {
            v[s]++;
            cout << t << endl;
            k--;
        } else {
            a.push_back(t);
        }
    }
    reverse(all(a));

    while (k--) {
        cout << a.back() << endl;
        a.pop_back();
    }
}

int main() {
    MayaZayn

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

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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'