QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#582590#9370. Gambling on Choosing RegionalsfengjiugeWA 102ms13452kbC++20903b2024-09-22 16:54:162024-09-22 16:54:16

Judging History

你现在查看的是最新测评结果

  • [2024-09-22 16:54:16]
  • 评测
  • 测评结果:WA
  • 用时:102ms
  • 内存:13452kb
  • [2024-09-22 16:54:16]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
map<string,multiset<int>>mp;
map<string,int>cnt;
vector<int>mm;
struct node{
	string s;
	int n;
} check[100005];
void fengjiuge(){
	int n,k;cin>>n>>k;
	int q;
	for(int i=1;i<=k;i++){
		int cc;cin>>cc;
		q=min(q,cc);
	}
	for(int i=1;i<=n;i++){
		int cc;string ss;
		cin>>cc>>ss;
		mp[ss].insert(cc);
		check[i]={ss,cc};
	}
	for(auto i:mp){
		int ccnt=0;
		for(auto j=i.second.rbegin();j!=i.second.rend();j--){
			mm.push_back(*j);
			ccnt++;
			if(ccnt>=q)break;
		}
		cnt[i.first]=ccnt;
	}
	sort(mm.begin(),mm.end());
	// for(int i=0;i<=1;i++)cout<<mm[i]<<" "<<endl;
	for(int i=1;i<=n;i++){
		int ans=(int)mm.size()-(lower_bound(mm.begin(),mm.end(),check[i].n)-mm.begin());
		cout<<ans<<endl;
	}
}
signed main(){
	int t=1;
	// cin>>t;
	while(t--){
		fengjiuge();
	}
}


详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 7720kb

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: 7444kb

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: 102ms
memory: 12440kb

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: 93ms
memory: 13452kb

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:

6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
6560
...

result:

wrong answer 1st lines differ - expected: '38094', found: '6560'