Submission #71698

# Submission time Handle Problem Language Result Execution time Memory
71698 2018-08-25T11:38:38 Z the_general(#2235, dbtlswkdrnss) The Ant Doing Hard Work (FXCUP3_ant) C++
100 / 100
3 ms 432 KB
#include "ant.h"

int FindK() {
	int l=0,r=100000000,temp=0,temp2=0;
	temp=r*2/3;
	temp2=DeliverCount(temp);
	switch(temp2){
	case 0:
		l=temp;
		break;
	case 1:
		l=temp/2;
		r=temp;
		break;
	default:
		r=temp/2;				
	}
	while(l<r-1){
		int mid=(l+r)/2;
		if(DeliverCount(mid)==0){
			l=mid;
		}
		else r=mid;
	}
	return r;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct
2 Correct 2 ms 356 KB Correct
3 Correct 3 ms 432 KB Correct
4 Correct 3 ms 432 KB Correct
5 Correct 2 ms 432 KB Correct