Submission #167248

# Submission time Handle Problem Language Result Execution time Memory
167248 2019-12-07T01:15:59 Z sans Hindeks (COCI17_hindeks) C++14
25 / 50
155 ms 5628 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:17: 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:44: 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 Incorrect 2 ms 376 KB Output isn't correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 256 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 35 ms 1272 KB Output is correct
9 Incorrect 155 ms 5628 KB Output isn't correct
10 Correct 63 ms 3064 KB Output is correct