Submission #62610

# Submission time Handle Problem Language Result Execution time Memory
62610 2018-07-29T10:42:46 Z 검수컵(#1978, imsifile) Cross on the Grid (FXCUP3_cross) C++
22 / 100
1000 ms 572 KB
#include<stdio.h>
#include<memory.h>

typedef long long lld;
const lld mod = 1000000007;

int N, ba[111]; lld dap=0;

void dfs(int ix){
	if(ix==N){
		dap++;
		return;
	}
	for(int i=0; i<4; i++){
		if(ix>0 && (i==2 && ba[ix-1])) continue;
		if(ix>0 && (i && ba[ix-1]==2)) continue;
		if(ix>0 && i==ba[ix-1] && i) continue;
		if(ix>1 && i==ba[ix-2] && i) continue;
		ba[ix]=i;
		dfs(ix+1);
		ba[ix]=0;
	}
}

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

Compilation message

cross.cpp: In function 'int main()':
cross.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N); N-=2;
  ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 3 ms 572 KB Output is correct
5 Correct 3 ms 572 KB Output is correct
6 Correct 2 ms 572 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 3 ms 572 KB Output is correct
5 Correct 3 ms 572 KB Output is correct
6 Correct 2 ms 572 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 5 ms 572 KB Output is correct
10 Execution timed out 1079 ms 572 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 3 ms 572 KB Output is correct
5 Correct 3 ms 572 KB Output is correct
6 Correct 2 ms 572 KB Output is correct
7 Correct 2 ms 572 KB Output is correct
8 Correct 2 ms 572 KB Output is correct
9 Correct 5 ms 572 KB Output is correct
10 Execution timed out 1079 ms 572 KB Time limit exceeded
11 Halted 0 ms 0 KB -