답안 #167249

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
167249 2019-12-07T01:21:14 Z sans Hindeks (COCI17_hindeks) C++14
25 / 50
154 ms 2296 KB
    #include <cstdio>
    #include <algorithm>
    #include <vector>
     
    using namespace std;
     
    int main(int argc, char **argv){
        int N; scanf("%d", &N);
        vector<int> h(N); for(auto &x: h) scanf("%d", &x);
        sort(h.begin(), h.end());
     
        for(int i = h.back(); i >= 0; --i){
            auto itr = lower_bound(h.begin(), h.end(), i);
            if(h.end() - itr == i){ printf("%d\n", i); break; }
        }
     
        return 0;
    }
     
    //cikisir

Compilation message

hindeks.cpp: In function 'int main(int, char**)':
hindeks.cpp:8:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int N; scanf("%d", &N);
                ~~~~~^~~~~~~~~~
hindeks.cpp:9:48: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         vector<int> h(N); for(auto &x: h) scanf("%d", &x);
                                           ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Correct 4 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 28 ms 760 KB Output is correct
9 Incorrect 154 ms 2296 KB Output isn't correct
10 Correct 61 ms 1400 KB Output is correct