# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
71713 | 2018-08-25T12:54:25 Z | the_general(#2235, dbtlswkdrnss) | 십자가 놓기 (FXCUP3_cross) | C++ | 4 ms | 580 KB |
#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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 460 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 504 KB | Output is correct |
7 | Correct | 2 ms | 504 KB | Output is correct |
8 | Correct | 4 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 460 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 504 KB | Output is correct |
7 | Correct | 2 ms | 504 KB | Output is correct |
8 | Correct | 4 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 504 KB | Output is correct |
10 | Correct | 2 ms | 540 KB | Output is correct |
11 | Correct | 2 ms | 564 KB | Output is correct |
12 | Correct | 2 ms | 564 KB | Output is correct |
13 | Incorrect | 2 ms | 580 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 432 KB | Output is correct |
4 | Correct | 2 ms | 460 KB | Output is correct |
5 | Correct | 2 ms | 484 KB | Output is correct |
6 | Correct | 2 ms | 504 KB | Output is correct |
7 | Correct | 2 ms | 504 KB | Output is correct |
8 | Correct | 4 ms | 504 KB | Output is correct |
9 | Correct | 2 ms | 504 KB | Output is correct |
10 | Correct | 2 ms | 540 KB | Output is correct |
11 | Correct | 2 ms | 564 KB | Output is correct |
12 | Correct | 2 ms | 564 KB | Output is correct |
13 | Incorrect | 2 ms | 580 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |