답안 #71793

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71793 2018-08-25T16:02:58 Z 내일_개학이다_ㅠㅠ(#2253, mAng0) 십자가 놓기 (FXCUP3_cross) C++17
100 / 100
3 ms 672 KB
#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

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);
     ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 472 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Correct 3 ms 528 KB Output is correct
7 Correct 3 ms 528 KB Output is correct
8 Correct 3 ms 672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 472 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Correct 3 ms 528 KB Output is correct
7 Correct 3 ms 528 KB Output is correct
8 Correct 3 ms 672 KB Output is correct
9 Correct 2 ms 672 KB Output is correct
10 Correct 3 ms 672 KB Output is correct
11 Correct 3 ms 672 KB Output is correct
12 Correct 2 ms 672 KB Output is correct
13 Correct 2 ms 672 KB Output is correct
14 Correct 3 ms 672 KB Output is correct
15 Correct 2 ms 672 KB Output is correct
16 Correct 3 ms 672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 472 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 3 ms 476 KB Output is correct
5 Correct 2 ms 476 KB Output is correct
6 Correct 3 ms 528 KB Output is correct
7 Correct 3 ms 528 KB Output is correct
8 Correct 3 ms 672 KB Output is correct
9 Correct 2 ms 672 KB Output is correct
10 Correct 3 ms 672 KB Output is correct
11 Correct 3 ms 672 KB Output is correct
12 Correct 2 ms 672 KB Output is correct
13 Correct 2 ms 672 KB Output is correct
14 Correct 3 ms 672 KB Output is correct
15 Correct 2 ms 672 KB Output is correct
16 Correct 3 ms 672 KB Output is correct
17 Correct 3 ms 672 KB Output is correct
18 Correct 3 ms 672 KB Output is correct
19 Correct 3 ms 672 KB Output is correct
20 Correct 3 ms 672 KB Output is correct
21 Correct 3 ms 672 KB Output is correct
22 Correct 2 ms 672 KB Output is correct
23 Correct 3 ms 672 KB Output is correct
24 Correct 3 ms 672 KB Output is correct
25 Correct 2 ms 672 KB Output is correct