32322023-02-23 09:20:44xxxHús sütés (75 pont)cpp14Accepted 75/7546ms5100 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){

  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
  	cin >> a[i];
  }
  
  sort(a.begin(), a.end());
  int vmi = 0, cnt = 0;
  for (int i = n-1; i >= 0; i--) {
  	if (cnt + a[i] > vmi) vmi = a[i] + cnt;
	  cnt++;
  }
 
  
  cout << vmi << endl;
  return 0;

}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1812 KiB
2Accepted0/03ms2008 KiB
3Accepted0/025ms2528 KiB
4Accepted3/33ms2428 KiB
5Accepted3/33ms2676 KiB
6Accepted3/33ms2856 KiB
7Accepted3/32ms2936 KiB
8Accepted4/43ms3080 KiB
9Accepted4/43ms3164 KiB
10Accepted4/43ms3288 KiB
11Accepted4/43ms3404 KiB
12Accepted4/43ms3508 KiB
13Accepted4/446ms4568 KiB
14Accepted4/446ms4548 KiB
15Accepted5/546ms4648 KiB
16Accepted5/546ms4548 KiB
17Accepted5/546ms4644 KiB
18Accepted4/446ms4524 KiB
19Accepted4/446ms4652 KiB
20Accepted4/441ms4868 KiB
21Accepted4/432ms5100 KiB
22Accepted2/243ms4948 KiB
23Accepted2/220ms4924 KiB