Submission #110843

# Submission time Handle Problem Language Result Execution time Memory
110843 2019-05-12T12:54:39 Z tjd229 The Ant Doing Hard Work (FXCUP3_ant) C++14
100 / 100
2 ms 384 KB
#include "ant.h"
int FindK() {
	int l = 1, r = 1e8; --r;
	int K = 0;
	int m = (r / 3) << 1;
	int cnt = DeliverCount(m);
	if (cnt) {
		l = m / (1 + cnt);
		if (!l) ++l;
		r = m / ( cnt);
	}
	else l = m + 1;
	
	while (l <= r) {
		m = (l + r) >> 1;
		if (DeliverCount(m)) r = m - 1;
		else l = m + 1;
	}
	return r+1;
}

Compilation message

ant.cpp: In function 'int FindK()':
ant.cpp:4:6: warning: unused variable 'K' [-Wunused-variable]
  int K = 0;
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Correct
2 Correct 2 ms 384 KB Correct
3 Correct 2 ms 256 KB Correct
4 Correct 2 ms 384 KB Correct
5 Correct 2 ms 256 KB Correct