답안 #86439

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86439 2018-11-26T10:07:07 Z Pluton Hindeks (COCI17_hindeks) C++14
30 / 50
100 ms 2592 KB
#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define sz size()
#define all(xx) xx.begin(),xx.end()
#define pb push_back
#define in insert
#define er erase
#define S second
#define F first
#define pii pair <int, int>
#define to_be continue
#define mp make_pair
#define stop exit (0)
#define fname ""
#define speed ios_base::sync_with_stdio(0);cin.tie(0)
#define input freopen (fname".in", "r", stdin)
#define output freopen (fname".out", "w", stdout)
//#define int ll
#define N 600000

using namespace std;

const int inf = 1e9 + 123;
const ll INF = 1e18 + 123;
const double pi = acos (-1.0);
const ld eps = 1e-3;

int n, a[N], ans;

int main ()
{
	speed;
	cin >> n;
	for (int i = 1; i <= n; i ++)
		cin >> a[i];
	sort (a + 1, a + 1 + n);
	if (a[1] >= n)
		cout << n, stop;
	for (int i = 1; i <= n; i ++)
	{    
		if (a[i] == n - i + 1)
		{
			ans = n - i + 1;
			break;
		}	
	}
	cout << ans;
}
//Coded by A....
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Incorrect 2 ms 516 KB Output isn't correct
4 Incorrect 2 ms 516 KB Output isn't correct
5 Correct 2 ms 644 KB Output is correct
6 Incorrect 2 ms 644 KB Output isn't correct
7 Correct 3 ms 644 KB Output is correct
8 Correct 20 ms 916 KB Output is correct
9 Incorrect 100 ms 2592 KB Output isn't correct
10 Correct 49 ms 2592 KB Output is correct