QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#583303 | #9370. Gambling on Choosing Regionals | Line_Mao | WA | 0ms | 3728kb | C++14 | 1.3kb | 2024-09-22 19:29:31 | 2024-09-22 19:29:32 |
Judging History
answer
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int> c(k);
for (int i = 0; i < k; i++) {
cin >> c[i];
}
sort(c.begin(), c.end());
vector<int> a(n);
vector<string> b(n);
map<string, vector<int>> mp;
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
mp[b[i]].push_back(a[i]);
}
for (auto& entry : mp) {
sort(entry.second.begin(), entry.second.end());
}
for (int i = 0; i < n; i++) {
int ans = 1;
auto it = mp.find(b[i]);
if (it != mp.end()) {
// Same category
for (int j = 1; j <= k; j++) {
if (a[i] < it->second[it->second.size() - j]) {
ans += j;
break;
}
}
} else {
// Different category
for (int j = 1; j <= k; j++) {
for (auto& pair : mp) {
if (pair.first != b[i] && a[i] < pair.second[pair.second.size() - j]) {
ans += j;
break;
}
}
}
}
cout << ans << endl;
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3728kb
input:
5 3 1 2 3 100 THU 110 PKU 95 PKU 105 THU 115 PKU
output:
2 2 2 1 1
result:
wrong answer 2nd lines differ - expected: '1', found: '2'