제출 #167249

#제출 시각아이디문제언어결과실행 시간메모리
167249sansHindeks (COCI17_hindeks)C++14
25 / 50
154 ms2296 KiB
    #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

컴파일 시 표준 에러 (stderr) 메시지

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);
                                           ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...