Submission #71713

#TimeUsernameProblemLanguageResultExecution timeMemory
71713the_general (#119)Cross on the Grid (FXCUP3_cross)C++98
22 / 100
4 ms580 KiB
#include<stdio.h> #define MOD 1000000007 int a(int); int b(int); int c(int); int d(int); int n; int A[4]; int B[4]; int C[4]; int D[4]; int a(int x){ if(x<3) return 0; if(x==3) return 1; return (((C[1]+D[0]-B[0])%MOD+B[1])%MOD+D[0])%MOD; } int b(int x){ if(x<3) return 0; if(x==3) return 1; return (((C[1]+D[0]-A[0])%MOD+A[1])%MOD+D[0])%MOD; } int c(int x){ if(x<3) return 0; if(x==3) return 1; return ((A[1]+B[1])%MOD+D[0])%MOD; } 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("%d", 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...