Submission #294578

#TimeUsernameProblemLanguageResultExecution timeMemory
294578ASDF123The Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> typedef vector<int> vi; using namespace std; int find_best(int n) { int pos = 0; while (1) { vi pos_res = ask(pos); if (pos_res[0] + pos_res[1] == 0) { return pos; } int l = pos, r = n; while (r - l > 1) { int mid = (l + r) >> 1; vi mid_res = ask(mid); if (pos_res[0] == mid_res[0] && pos_res[1] == mid_res[1]) { l = mid; } else { r = mid; } } pos = l + 1; } for (int i = 0; i < n; i++) { vi res = ask(i); if(res[0] + res[1] == 0) return i; } return 0; }

Compilation message (stderr)

prize.cpp:3:9: error: 'vector' does not name a type
    3 | typedef vector<int> vi;
      |         ^~~~~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:9:5: error: 'vi' was not declared in this scope
    9 |     vi pos_res = ask(pos);
      |     ^~
prize.cpp:10:9: error: 'pos_res' was not declared in this scope
   10 |     if (pos_res[0] + pos_res[1] == 0) {
      |         ^~~~~~~
prize.cpp:16:9: error: expected ';' before 'mid_res'
   16 |       vi mid_res = ask(mid);
      |         ^~~~~~~~
      |         ;
prize.cpp:17:11: error: 'pos_res' was not declared in this scope
   17 |       if (pos_res[0] == mid_res[0] && pos_res[1] == mid_res[1]) {
      |           ^~~~~~~
prize.cpp:17:25: error: 'mid_res' was not declared in this scope
   17 |       if (pos_res[0] == mid_res[0] && pos_res[1] == mid_res[1]) {
      |                         ^~~~~~~
prize.cpp:26:3: error: 'vi' was not declared in this scope; did you mean 'i'?
   26 |   vi res = ask(i);
      |   ^~
      |   i
prize.cpp:27:6: error: 'res' was not declared in this scope
   27 |   if(res[0] + res[1] == 0)
      |      ^~~