Submission #2532195
Source Code Expand
#include<bits/stdc++.h> #define MD 1000000007 #define MAXN 3005 using namespace std; int read(){ char c;int x;while(c=getchar(),c<'0'||c>'9');x=c-'0'; while(c=getchar(),c>='0'&&c<='9') x=x*10+c-'0';return x; } int n,m,f[MAXN][MAXN][2],ans; int main() { n=read();m=read(); f[0][0][1]=1; for(int i=1;i<=n;i++) f[0][i][0]=1; for(int i=0;i<=m-1;i++) for(int j=0;j<=n;j++) for(int k=0;k<=1;k++){ if(j) f[i+1][j][k|(j==1)]=(f[i+1][j][k|(j==1)]+f[i][j][k])%MD; if(j) f[i+1][j-1][k|(j==1)]=(f[i+1][j-1][k|(j==1)]+f[i][j][k])%MD; if(n-j) f[i+1][j][k]=(f[i+1][j][k]+f[i][j][k])%MD; if(n-j) f[i+1][j+1][k]=(f[i+1][j+1][k]+f[i][j][k])%MD; } for(int i=0;i<=n;i++) ans=(ans+f[m][i][1])%MD; printf("%d",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Sorted Arrays |
User | stevensonson |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 757 Byte |
Status | RE |
Exec Time | 2103 ms |
Memory | 70784 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | WA | 1 ms | 256 KB |
sample_02.txt | WA | 1 ms | 256 KB |
sample_03.txt | WA | 1 ms | 256 KB |
subtask_1_01.txt | TLE | 2103 ms | 43264 KB |
subtask_1_02.txt | TLE | 2103 ms | 53504 KB |
subtask_1_03.txt | RE | 1868 ms | 70784 KB |
subtask_1_04.txt | TLE | 2103 ms | 26880 KB |
subtask_1_05.txt | TLE | 2103 ms | 26880 KB |
subtask_1_06.txt | TLE | 2103 ms | 26880 KB |
subtask_1_07.txt | TLE | 2103 ms | 26880 KB |
subtask_1_08.txt | TLE | 2103 ms | 26880 KB |
subtask_1_09.txt | TLE | 2103 ms | 26880 KB |
subtask_1_10.txt | RE | 111 ms | 68352 KB |
subtask_1_11.txt | RE | 111 ms | 68352 KB |