QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#583484 | #9370. Gambling on Choosing Regionals | Line_Mao | WA | 0ms | 3732kb | C++14 | 961b | 2024-09-22 20:10:41 | 2024-09-22 20:10:42 |
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&mp1:mp)
{
sort(mp1.second.begin(), mp1.second.end());
}
for (int i = 0; i < n; i++)
{
int ans = 1;
for (auto&it:mp)
{
if (it.first == b[i])
{
for (int j = c[0] - 1; j > 0; j--)
{
if (a[i] < it.second[mp[it.first].size() - j])
{
ans = ans + j;
break;
}
}
}
else
{
for (int j = c[0]; j > 0; j--)
{
if (a[i] < it.second[mp[it.first].size() - j])
{
ans += j;
break;
}
}
}
}
printf("%d",ans);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3732kb
input:
5 3 1 2 3 100 THU 110 PKU 95 PKU 105 THU 115 PKU
output:
21221
result:
wrong answer 1st lines differ - expected: '2', found: '21221'