Submission #2124513
Source Code Expand
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; const int N=2005; const int MOD=1000000007; int n,k,f[N][N][3]; void updata(int &x,int y) { x+=y;x-=x>=MOD?MOD:0; } int main() { scanf("%d%d",&n,&k); f[n+1][0][2]=1; for (int i=n+1;i>1;i--) { for (int j=n;j>=0;j--) updata(f[i][j][1],f[i][j+1][1]); for (int j=0;j<=n;j++) for (int t=1;t<=2;t++) { updata(f[i-1][j+1][2],f[i][j][t]); updata(f[i-1][j][1],f[i][j][t]); } } int ans=f[1][n-k][1]; for (int j=1;j<=n-k-1;j++) updata(ans,ans); printf("%d",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Solitaire |
User | beginend |
Language | C++14 (GCC 5.4.1) |
Score | 1200 |
Code Size | 646 Byte |
Status | AC |
Exec Time | 45 ms |
Memory | 47360 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:20:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d",&n,&k); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1200 / 1200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt |
All | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 1 ms | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
00_example_03.txt | AC | 45 ms | 47360 KB |
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 16 ms | 26240 KB |
03.txt | AC | 1 ms | 384 KB |
04.txt | AC | 3 ms | 4864 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | AC | 1 ms | 256 KB |
07.txt | AC | 1 ms | 384 KB |
08.txt | AC | 1 ms | 512 KB |
09.txt | AC | 41 ms | 45312 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 1 ms | 256 KB |
12.txt | AC | 40 ms | 45312 KB |
13.txt | AC | 2 ms | 2816 KB |
14.txt | AC | 44 ms | 47360 KB |
15.txt | AC | 6 ms | 13440 KB |
16.txt | AC | 45 ms | 47360 KB |
17.txt | AC | 45 ms | 47360 KB |
18.txt | AC | 45 ms | 47360 KB |
19.txt | AC | 45 ms | 47360 KB |
20.txt | AC | 45 ms | 47360 KB |
21.txt | AC | 1 ms | 256 KB |
22.txt | AC | 45 ms | 47360 KB |
23.txt | AC | 45 ms | 47360 KB |