40 pts 求调
查看原帖
40 pts 求调
724593
Decepticon楼主2023/8/21 21:12

评测记录

#include <bits/stdc++.h>
using namespace std;
int n,k,a[1000005],b[1000005],cnt = 1,p = 0;
int ans;

int main(){
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		int x;
		cin >> x;
		if(b[x] == 0){
			a[cnt++] = x;
			b[x]++;
		} else {
			b[x]++;
		}
	}
	for(int i = 1; i < cnt; i++){
		p = max(p,b[a[i]]); 
	}
	if(k >= p){
		cout << "pigstd";
	} else {
		for(int i = 1; i < cnt; i++){
			if(b[a[i]]+k >= p) ans++;
		}
		cout << ans;
	}
	return 0;
}
2023/8/21 21:12
加载中...