Submission #167249

#TimeUsernameProblemLanguageResultExecution timeMemory
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

Compilation message (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...