Submission #288965

#TimeUsernameProblemLanguageResultExecution timeMemory
288965wdjpng커다란 상품 (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include "prize.h"
#define lint long long
#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;

int find_best(int n)
{

	int oldSum = 1e9;
	int curI = -1;
	bool first=true;
	while (true)
	{
		int start=-1, end=n;
		while(end-start>1){
			int cur = (start+end)/2;
			vector<int>ans=ask(cur);
			if(first){
				first=false;
				oldSum=ans[0]+ans[1];
			}
			if(ans[0]+ans[1]==0){return cur;}
			if(ans[0]+ans[1]<oldSum){
				oldSum=ans[0]+ans[1];
				break;
			}
			else if(ans[0]) end=cur;
			else start=cur;
		}
	}

	assert(false);
}

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:33:2: error: 'assert' was not declared in this scope
   33 |  assert(false);
      |  ^~~~~~
prize.cpp:2:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    1 | #include "prize.h"
  +++ |+#include <cassert>
    2 | #define lint long long
prize.cpp:11:6: warning: unused variable 'curI' [-Wunused-variable]
   11 |  int curI = -1;
      |      ^~~~