Submission #364095

#TimeUsernameProblemLanguageResultExecution timeMemory
364095yasseenkamelCONSUL (info1cup19_consul)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.h" //#include "grader.cpp" bool vis[1000000005]; void solve(int n){ int a[n + 5]; for(int i = 1 ; i <= n ; i ++){ int x = kth(i); a[i] = x; } sort(a,a + n); int cnt = 1; for(int i = 2 ; i <= n ; i ++){ if(a[i] != a[i - 1]){ if(cnt > n / 3){ say_answer(a[i - 1]); return; } cnt = 0; } cnt ++; } if(cnt > n / 3){ say_answer(a[n]); return; } say_answer(-1); }

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:13:5: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   13 |     sort(a,a + n);
      |     ^~~~
      |     std::sort
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from consul.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:4887:5: note: 'std::sort' declared here
 4887 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~