Submission #71793

#TimeUsernameProblemLanguageResultExecution timeMemory
71793내일_개학이다_ㅠㅠ (#119)Cross on the Grid (FXCUP3_cross)C++17
100 / 100
3 ms672 KiB
#include<bits/stdc++.h> #define je 1000000007 using namespace std; long long mat[33][6][6]; long long ans[6], sv[6]; int main(){ mat[0][0][0] = 1; mat[0][1][0] = 2; mat[0][2][0] = 1; mat[0][3][1] = 1; mat[0][5][1] = 1; mat[0][4][2] = 1; mat[0][0][3] = 1; mat[0][1][3] = 1; mat[0][2][3] = 1; mat[0][0][4] = 1; mat[0][1][4] = 2; mat[0][3][5] = 1; for(int i=1;i<=32;i++){ for(int l=0;l<6;l++){ for(int j=0;j<6;j++){ for(int k=0;k<6;k++){ long long cal = (mat[i-1][j][l] * mat[i-1][l][k]) % je; mat[i][j][k] = (mat[i][j][k] + cal) % je; } } } } int n; scanf("%d", &n); n-=2; ans[0] = 1; for(int ii=0;n;ii++){ if(n%2){ for(int i=0;i<6;i++){sv[i] = ans[i]; ans[i] = 0;} for(int i=0;i<6;i++){ for(int j=0;j<6;j++){ long long cal = (mat[ii][i][j] * sv[j]) % je; ans[i] = (ans[i] + cal) % je; } } } n >>= 1; } for(int i=1;i<=5;i++) ans[0] = (ans[0] + ans[i]) % je; printf("%lld\n", ans[0]); }

Compilation message (stderr)

cross.cpp: In function 'int main()':
cross.cpp:31:10: 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...