Submission #71729

# Submission time Handle Problem Language Result Execution time Memory
71729 2018-08-25T13:44:37 Z the_general(#2235, dbtlswkdrnss) Cross on the Grid (FXCUP3_cross) C++
0 / 100
3 ms 368 KB
#include<stdio.h>
#define MOD 1000000007

long long int a(int);
long long int b(int);
long long int c(int);
long long int d(int);
int n;
long long int A[4];
long long int B[4];
long long int C[4];
long long int D[4];

long long int a(int x){
	if(x<3) return 0;
	if(x==3) return 1;
	return (((C[1]+A[0]+C[0])%MOD+B[1])%MOD+D[0])%MOD;
}

long long int b(int x){
	if(x<3) return 0;
	if(x==3) return 1;
	return (((C[1]+B[0]+D[0])%MOD+A[1])%MOD+D[0])%MOD;
}

long long int c(int x){
	if(x<3) return 0;
	if(x==3) return 1;
	return ((A[1]+B[1])%MOD+D[0])%MOD;
}

long long int d(int x){
	if(x==1 || x==2){
		D[3]=1;
		for(int i=0;i<3;i++){
			D[i]=D[i+1];
		}
		return 1;
	}
	A[3]=a(x);
	B[3]=b(x);
	C[3]=c(x);
	D[3]=(((A[3]+B[3])%MOD+C[3])%MOD+D[2])%MOD;
	for(int i=0;i<3;i++){
		A[i]=A[i+1];
		B[i]=B[i+1];
		C[i]=C[i+1];
		D[i]=D[i+1];
	}
	return D[3];
}

int main(){
	scanf("%d", &n);
	for(int i=1;i<=n;i++){
		d(i);
	}
	printf("%lld", D[3]);
}

Compilation message

cross.cpp: In function 'int main()':
cross.cpp:54:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 3 ms 368 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 3 ms 368 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 3 ms 368 KB Output isn't correct
3 Halted 0 ms 0 KB -