Submission #167250

# Submission time Handle Problem Language Result Execution time Memory
167250 2019-12-07T01:21:28 Z sans Hindeks (COCI17_hindeks) C++14
50 / 50
140 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);
                                           ~~~~~^~~~~~~~~~
# Verdict Execution time Memory 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 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 28 ms 760 KB Output is correct
9 Correct 140 ms 2296 KB Output is correct
10 Correct 61 ms 1272 KB Output is correct