7532022-01-08 15:50:30mraronHús sütés (75 pont)cpp14Accepted 75/7521ms9820 KiB
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair
#define ins insert

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

using ll = long long;
using ull = unsigned long long ;
using ld = long double ;
using str = string;
using ordered_set=tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI=acos(-1);
const ll INF = 1LL<<62;
const ll MINF = -(1LL<<62);

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)


int main() {
	IO;
	int n;
	cin>>n;
	
	vector<int> t(n);
	for(int& i:t) cin>>i;
	
	sort(all(t));
	
	int ans=t[sz(t)-1];
	for(int i=sz(t)-1;i>=0;i--) {
		ans=max(ans, t[i]+sz(t)-i-1);
	}
	
	cout<<ans<<"\n";
	
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms2000 KiB
2Accepted0/02ms1976 KiB
3Accepted0/013ms2624 KiB
4Accepted3/31ms2416 KiB
5Accepted3/31ms2396 KiB
6Accepted3/31ms2400 KiB
7Accepted3/31ms2400 KiB
8Accepted4/41ms2408 KiB
9Accepted4/41ms2408 KiB
10Accepted4/42ms2420 KiB
11Accepted4/42ms2428 KiB
12Accepted4/42ms2440 KiB
13Accepted4/419ms3788 KiB
14Accepted4/419ms4464 KiB
15Accepted5/517ms5152 KiB
16Accepted5/517ms5844 KiB
17Accepted5/517ms6524 KiB
18Accepted4/418ms7208 KiB
19Accepted4/421ms7884 KiB
20Accepted4/414ms8700 KiB
21Accepted4/414ms9100 KiB
22Accepted2/217ms9608 KiB
23Accepted2/28ms9820 KiB