QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#626010 | #9370. Gambling on Choosing Regionals | 2366503423 | WA | 198ms | 14596kb | C++14 | 967b | 2024-10-09 22:19:41 | 2024-10-09 22:19:41 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
bool cmp(long long int a,long long int b)
{
return a>b;
}
int main()
{
int n,k;cin>>n>>k;
set <int> xiao;
for(int i=0;i<k;i++){long long int x;cin>>x;xiao.insert(x);}
k=*xiao.begin();//cout<<k<<'\n';
map < string , vector<long long int> > ma;
vector <long long int> dui,pai;
map <long long int,int> book;
for(int i=0;i<n;i++)
{
string s;long long int x;cin>>x>>s;
ma[s].push_back(x);
dui.push_back(x);
pai.push_back(x);
}
int num=ma.size();
sort(pai.begin(),pai.end(),cmp);
for(int i=0;i<pai.size();i++)
{
book[pai[i]]=i+1;
}
for(auto &it:ma)
{
sort(it.second.begin(),it.second.end(),cmp);
}
for(auto &it:ma)
{
for(int i=0;i<it.second.size();i++)
{
long long int he=it.second[i];
if(i+1>k) book[he]-=i+1-k;
if(book[he]>num*k) book[he]=num*k;
}
}
for(int i=0;i<dui.size();i++)
{
cout<<book[dui[i]]<<'\n';
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
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: 3584kb
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: -100
Wrong Answer
time: 198ms
memory: 14596kb
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 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...
result:
wrong answer 2nd lines differ - expected: '999', found: '1000'