Submission #1145872

#TimeUsernameProblemLanguageResultExecution timeMemory
1145872idonoamCONSUL (info1cup19_consul)C++20
Compilation error
0 ms0 KiB
#include "grader.h" void solve(int n) { vector<int> vec(n); for(int i = 0; i < n;i++){ vec[i] = kth(i+1); } sort(vec.begin(), vec.end()); long long ls = vec[0], cou = 1; bool cont = true; for(int i = 1; i < n && cont; i++){ if(ls == vec[i]){ if(++cou > n/3){ say_answer(ls); cont = false; } } else{ ls = vec[i]; cou = 1; } } if(cont){say_answer(-1);} }

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> vec(n);
      |     ^~~~~~
consul.cpp:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> vec(n);
      |            ^~~
consul.cpp:7:9: error: 'vec' was not declared in this scope
    7 |         vec[i] = kth(i+1);
      |         ^~~
consul.cpp:9:10: error: 'vec' was not declared in this scope
    9 |     sort(vec.begin(), vec.end());
      |          ^~~
consul.cpp:9:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 |     sort(vec.begin(), vec.end());
      |     ^~~~
      |     short
consul.cpp:14:18: error: 'cou' was not declared in this scope
   14 |             if(++cou > n/3){
      |                  ^~~
consul.cpp:21:13: error: 'cou' was not declared in this scope
   21 |             cou = 1;
      |             ^~~