Submission #781285

#TimeUsernameProblemLanguageResultExecution timeMemory
781285OrazBThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "prize.h"

int find_best(int n) {
	int l = 0, r = n;
	while(l <= r){
		int md = (l+r)/2;
		vector<int> a = ask(md);
		if (a[0] == a[1]) return md;
		if (a[0] > a[1]) r = md - 1;
		else l = md + 1;
	}
}

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:8:3: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    8 |   vector<int> a = ask(md);
      |   ^~~~~~
      |   std::vector
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from prize.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
prize.cpp:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> a = ask(md);
      |          ^~~
prize.cpp:9:7: error: 'a' was not declared in this scope
    9 |   if (a[0] == a[1]) return md;
      |       ^
prize.cpp:10:7: error: 'a' was not declared in this scope
   10 |   if (a[0] > a[1]) r = md - 1;
      |       ^
prize.cpp:13:1: warning: control reaches end of non-void function [-Wreturn-type]
   13 | }
      | ^