Submission #18097

# Submission time Handle Problem Language Result Execution time Memory
18097 2016-01-20T06:51:18 Z comet 동전 게임 (KOI15_coin) C++
100 / 100
23 ms 1084 KB
#include <cstdio>

int N,Q;

int max(int x,int y){return x>y?x:y;}

bool chk(int x,int y,bool delta){
	x=max(0,x),y=max(0,y);
	int round=max(x,y);
	if((N-round)+x-delta<y)return 0;
	if(x>(N-round)+y)return 0;
	return 1;
}

int main(){

	scanf("%d",&N);
	scanf("%d",&Q);
	int x,y;
	for(int i=0;i<Q;i++){
		scanf("%d%d",&x,&y);
		if(chk(x-1,y,0)||chk(x,y-1,1)||chk(x,y,0))puts("1");
		else puts("0");
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Correct 0 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 2 ms 1084 KB Output is correct
4 Correct 23 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 13 ms 1084 KB Output is correct
4 Correct 18 ms 1084 KB Output is correct
5 Correct 23 ms 1084 KB Output is correct
6 Correct 16 ms 1084 KB Output is correct
7 Correct 16 ms 1084 KB Output is correct
8 Correct 0 ms 1084 KB Output is correct