Submission #1695443
Source Code Expand
#include<stdio.h> #include<cctype> #include<algorithm> using namespace std; #define Maxn 3009 int read() { int x=0;char ch=getchar(); while(!isdigit(ch)) ch=getchar(); while(isdigit(ch)) { x=x*10+ch-48; ch=getchar(); } return x; } int n,m,p,ans,f[Maxn][Maxn][2]; int main(){ n=read();m=read();p=read(); f[0][0][1]=1; for(int i=1;i<=n;++i) f[0][i][0]=1; for(int i=0;i<m;++i) for(int j=0;j<=n;++j) for(int k=0;k<=1;++k) { if(j) { (f[i+1][j-1][k|(j==1)]+=f[i][j][k])%=p; (f[i+1][j][k|(j==1)]+=f[i][j][k])%=p; } if(n-j) { (f[i+1][j][k]+=f[i][j][k])%=p; (f[i+1][j+1][k]+=f[i][j][k])%=p; } } int ans=0; for(int i=0;i<=n;++i) (ans+=f[m][i][1])%=p; printf("%d\n",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Sorted Arrays |
User | qrsikno |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 772 Byte |
Status | RE |
Exec Time | 2104 ms |
Memory | 69760 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 | 0 ms | 128 KB |
sample_02.txt | WA | 0 ms | 128 KB |
sample_03.txt | WA | 0 ms | 128 KB |
subtask_1_01.txt | TLE | 2103 ms | 34944 KB |
subtask_1_02.txt | TLE | 2103 ms | 45184 KB |
subtask_1_03.txt | TLE | 2104 ms | 69760 KB |
subtask_1_04.txt | TLE | 2103 ms | 22656 KB |
subtask_1_05.txt | TLE | 2103 ms | 22656 KB |
subtask_1_06.txt | TLE | 2103 ms | 22656 KB |
subtask_1_07.txt | TLE | 2103 ms | 22656 KB |
subtask_1_08.txt | TLE | 2103 ms | 22656 KB |
subtask_1_09.txt | TLE | 2103 ms | 22656 KB |
subtask_1_10.txt | TLE | 2103 ms | 128 KB |
subtask_1_11.txt | RE | 112 ms | 68224 KB |