# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
71793 | 내일_개학이다_ㅠㅠ (#119) | Cross on the Grid (FXCUP3_cross) | C++17 | 3 ms | 672 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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]);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |