QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#583490 | #9370. Gambling on Choosing Regionals | Line_Mao | WA | 900ms | 7956kb | C++14 | 963b | 2024-09-22 20:12:34 | 2024-09-22 20:12:40 |
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 (const auto&it:mp)
{
if (it.first == b[i])
{
for (int j = c[0] - 1; j > 0; j--)
{
if (a[i] < it.second[it.second.size() - j])
{
ans = ans + j;
break;
}
}
}
else
{
for (int j = c[0]; j > 0; j--)
{
if (a[i] < it.second[it.second.size() - j])
{
ans += j;
break;
}
}
}
}
printf("%d\n",ans);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3800kb
input:
5 3 1 2 3 100 THU 110 PKU 95 PKU 105 THU 115 PKU
output:
2 1 2 2 1
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
5 2 2 3 100 THU 110 PKU 95 PKU 105 THU 115 PKU
output:
4 2 4 3 1
result:
ok 5 lines
Test #3:
score: 0
Accepted
time: 900ms
memory: 7796kb
input:
100000 100000 57148 51001 13357 71125 98369 67226 49388 90852 66291 39573 38165 97007 15545 51437 89611 41523 27799 15529 16434 44291 47134 90227 26873 52252 41605 21269 9135 55784 70744 17563 79061 73981 70529 35681 91073 52031 23811 79501 1607 46365 76868 72137 71041 29217 96749 46417 40199 55907 ...
output:
1000 999 1000 1000 1000 1000 1000 1000 1000 869 1000 958 1000 1000 1000 1000 999 1000 1000 1000 1000 1000 1000 990 1000 1000 1000 631 1000 1000 1000 956 1000 1000 1000 1000 1000 1000 575 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 993 1000 1000 999 1000 995 1000 1...
result:
ok 100000 lines
Test #4:
score: -100
Wrong Answer
time: 695ms
memory: 7956kb
input:
100000 100000 67147 61000 23356 81124 108368 77225 59387 100851 76290 49572 48164 107006 25544 61436 99610 51522 37798 25528 26433 54290 57133 100226 36872 62251 51604 31268 19134 65783 80743 27562 89060 83980 80528 45680 101072 62030 33810 89500 11606 56364 86867 82136 81040 39216 106748 56416 5019...
output:
76123 98212 52362 99687 57248 51434 83414 88088 65743 64025 98971 94252 79642 73758 75402 99704 63226 90443 100000 97926 65369 75535 82745 60352 73618 89542 94777 99818 99566 56467 82844 83287 63972 99884 88887 86839 96283 49967 67748 99600 57932 92846 99986 84840 77144 97887 99933 61912 61540 99902...
result:
wrong answer 1st lines differ - expected: '38094', found: '76123'