71422023-12-31 13:08:11IgnácHús sütés (75 pont)cpp17Accepted 75/7548ms4576 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> husok(n);
	for (int i = 0; i < n; i++) {
		cin >> husok[i];
	}

	sort(husok.rbegin(), husok.rend());
	int maxi = 0;
	for (int i = 0; i < n; i++) {
		if (husok[i] + i > maxi) maxi = husok[i] + i;
	}

	cout << maxi;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1812 KiB
2Accepted0/03ms2060 KiB
3Accepted0/025ms2528 KiB
4Accepted3/33ms2304 KiB
5Accepted3/33ms2432 KiB
6Accepted3/33ms2508 KiB
7Accepted3/33ms2632 KiB
8Accepted4/43ms2524 KiB
9Accepted4/43ms2520 KiB
10Accepted4/43ms2652 KiB
11Accepted4/43ms2736 KiB
12Accepted4/43ms2736 KiB
13Accepted4/448ms3436 KiB
14Accepted4/448ms3724 KiB
15Accepted5/546ms3904 KiB
16Accepted5/548ms4024 KiB
17Accepted5/548ms4112 KiB
18Accepted4/448ms4216 KiB
19Accepted4/448ms4452 KiB
20Accepted4/445ms4428 KiB
21Accepted4/434ms4424 KiB
22Accepted2/243ms4432 KiB
23Accepted2/220ms4576 KiB