답안 #884379

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
884379 2023-12-07T09:10:31 Z gutzzy Hindeks (COCI17_hindeks) C++14
50 / 50
142 ms 5588 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> papers(n);
    for(int i=0;i<n;i++){
        cin >> papers[i];
    }
    sort(papers.begin(),papers.end());
    
    bool found = false;
    for(int i=1;i<=n;i++){
        int pos = n-i;
        if(papers[pos]<i){
            found = true;
            cout << i-1 << endl;
            break;
        }
    }
    if(not(found)) cout << n << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Correct 26 ms 1428 KB Output is correct
9 Correct 142 ms 5588 KB Output is correct
10 Correct 73 ms 2908 KB Output is correct