답안 #171629

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171629 2019-12-29T12:25:51 Z ToniB Hindeks (COCI17_hindeks) C++14
50 / 50
336 ms 5752 KB
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int cmp(int x, int y){
	return x > y;
}

int main(){
    int n;
    cin >> n;
    
    int sol = 0;
    
    int all[n] = {0};
    
    for(int i = 0; i < n; ++i){
    	cin >> all[i];
	}
	
	sort(all, all + n, cmp);
	
	for(int i = 0; i < n; ++i){
		if(all[i] < i + 1){
			sol = i;
			break;
		}
		if(i == n - 1){
			sol = n;
		}
	}
	
	cout << sol;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 356 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 8 ms 376 KB Output is correct
8 Correct 64 ms 1272 KB Output is correct
9 Correct 336 ms 5752 KB Output is correct
10 Correct 170 ms 3064 KB Output is correct