71702024-01-01 19:38:04tomi7Hús sütés (75 pont)cpp17Wrong answer 21/7557ms12380 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;cin>>n;
	vector<int> a(n);
	vector<int> szamolo(1000000);
	for(int i=0;i<n;i++){
		cin>>a[i];
		szamolo[a[i]]++;
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	int szam=1;
	int elozo=0;
	int korok=0;
	for(int i=a[0];i>0;i--){
		if(szamolo[i]+elozo>szam){
			korok+=szamolo[i]+elozo-szam;
			szamolo[i]-=szam;
		}
		if(i!=a[0]){
			elozo=szamolo[i];
		}
		if(i!=a[0]){
			szam++;
		}
	}
	cout<<korok+a[0]<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base21/75
1Accepted0/06ms9532 KiB
2Accepted0/04ms9728 KiB
3Accepted0/032ms10332 KiB
4Accepted3/36ms9892 KiB
5Wrong answer0/34ms10024 KiB
6Wrong answer0/36ms10392 KiB
7Wrong answer0/34ms10568 KiB
8Wrong answer0/44ms10784 KiB
9Wrong answer0/46ms10832 KiB
10Wrong answer0/46ms10780 KiB
11Wrong answer0/47ms11032 KiB
12Wrong answer0/47ms11188 KiB
13Accepted4/457ms11956 KiB
14Wrong answer0/452ms11912 KiB
15Wrong answer0/550ms12168 KiB
16Wrong answer0/552ms12192 KiB
17Wrong answer0/554ms12192 KiB
18Accepted4/454ms12380 KiB
19Accepted4/454ms12340 KiB
20Accepted4/446ms12336 KiB
21Wrong answer0/435ms12344 KiB
22Wrong answer0/246ms12368 KiB
23Accepted2/224ms12348 KiB