답안 #62613

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
62613 2018-07-29T11:02:04 Z 검수컵(#1978, imsifile) 십자가 놓기 (FXCUP3_cross) C++
57 / 100
448 ms 204112 KB
#include<stdio.h>
#include<memory.h>

typedef long long lld;
const lld mod = 1000000007;

int N; lld ba[1010101][4][4], dap=0;

lld dfs(int ix, int p1, int p2){
	lld sum=0;
	if(ix==0) return 1;
	if(ba[ix][p1][p2]) return ba[ix][p1][p2]-1;
	for(int i=0; i<4; i++){
		if(i==2 && p1) continue;
		if(i && p1==2) continue;
		if(i==p1 && i) continue;
		if(i==p2 && i) continue;
		sum += dfs(ix-1, i, p1);
	}
	ba[ix][p1][p2] = (sum%mod)+1;
	return ba[ix][p1][p2]-1;
}

int main(){
	scanf("%d", &N); N-=2;
	printf("%lld\n", dfs(N, 0, 0));
	return 0;
}

Compilation message

cross.cpp: In function 'int main()':
cross.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N); N-=2;
  ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 3 ms 612 KB Output is correct
5 Correct 2 ms 612 KB Output is correct
6 Correct 2 ms 612 KB Output is correct
7 Correct 2 ms 612 KB Output is correct
8 Correct 2 ms 612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 3 ms 612 KB Output is correct
5 Correct 2 ms 612 KB Output is correct
6 Correct 2 ms 612 KB Output is correct
7 Correct 2 ms 612 KB Output is correct
8 Correct 2 ms 612 KB Output is correct
9 Correct 2 ms 612 KB Output is correct
10 Correct 2 ms 612 KB Output is correct
11 Correct 3 ms 612 KB Output is correct
12 Correct 3 ms 612 KB Output is correct
13 Correct 3 ms 1000 KB Output is correct
14 Correct 7 ms 3048 KB Output is correct
15 Correct 149 ms 68016 KB Output is correct
16 Correct 448 ms 204112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 3 ms 612 KB Output is correct
5 Correct 2 ms 612 KB Output is correct
6 Correct 2 ms 612 KB Output is correct
7 Correct 2 ms 612 KB Output is correct
8 Correct 2 ms 612 KB Output is correct
9 Correct 2 ms 612 KB Output is correct
10 Correct 2 ms 612 KB Output is correct
11 Correct 3 ms 612 KB Output is correct
12 Correct 3 ms 612 KB Output is correct
13 Correct 3 ms 1000 KB Output is correct
14 Correct 7 ms 3048 KB Output is correct
15 Correct 149 ms 68016 KB Output is correct
16 Correct 448 ms 204112 KB Output is correct
17 Runtime error 5 ms 204112 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Halted 0 ms 0 KB -