Submission #71729

#TimeUsernameProblemLanguageResultExecution timeMemory
71729the_general (#119)Cross on the Grid (FXCUP3_cross)C++98
0 / 100
3 ms368 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...