QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#593246 | #8243. Contest Advancement | enze# | WA | 0ms | 3796kb | C++20 | 1.0kb | 2024-09-27 12:53:49 | 2024-09-27 12:53:50 |
Judging History
answer
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
int main() {
int n, k, c;
cin >> n >> k >> c;
vector<pair<int, int>> teams(n); // to store team ID and school ID
for (int i = 0; i < n; i++) {
cin >> teams[i].first >> teams[i].second;
}
vector<int> qualified_teams;
unordered_map<int, int> school_count; // to count how many teams per school
for (int i = 0; i < n && qualified_teams.size() < k; i++) {
int team_id = teams[i].first;
int school_id = teams[i].second;
// Check if the school has not exceeded the limit, or if we need more teams
if (school_count[school_id] < c || qualified_teams.size() + (c - school_count[school_id]) < k) {
qualified_teams.push_back(team_id);
school_count[school_id]++;
}
}
// Output the qualified teams in rank order
for (int i = 0; i < k; i++) {
cout << qualified_teams[i] << endl;
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3796kb
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 5 9 2 6
result:
wrong answer 4th lines differ - expected: '9', found: '5'