답안 #19007

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19007 2016-02-17T02:56:23 Z kriii 동전 (kriii4_E) C++14
5 / 100
15 ms 1404 KB
#include <stdio.h>

int N; int range[1<<16]; bool win[1<<16];

int main()
{
	scanf ("%d",&N);
	for (int i=1;i<(1<<N);i++){
		int r = i, x = i & (-i), l;
		while (r){
			l = r & (-r);
			r -= l;
		}
		range[i] = l * 2 - i;
	}

	for (int i=(1<<N)-2;i>=0;i--){
		int rem = (1<<N) - 1 - i;

		for (int j=rem;j;j=(j-1)&rem){
			if (range[j] & i) continue;
			if (!win[i+j]){win[i] = 1; break;}
		}
	}

	int ans = 0;
	for (int i=0;i<(1<<N);i++) if (!win[i]) ans++;
	printf ("%d\n",ans);

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1404 KB Output is correct
2 Correct 0 ms 1404 KB Output is correct
3 Correct 0 ms 1404 KB Output is correct
4 Correct 0 ms 1404 KB Output is correct
5 Correct 0 ms 1404 KB Output is correct
6 Correct 0 ms 1404 KB Output is correct
7 Correct 0 ms 1404 KB Output is correct
8 Correct 0 ms 1404 KB Output is correct
9 Correct 0 ms 1404 KB Output is correct
10 Correct 0 ms 1404 KB Output is correct
11 Correct 0 ms 1404 KB Output is correct
12 Correct 0 ms 1404 KB Output is correct
13 Correct 0 ms 1404 KB Output is correct
14 Correct 5 ms 1404 KB Output is correct
15 Correct 15 ms 1404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 1400 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -