Submission #1693330
Source Code Expand
#include <bits/stdc++.h> using namespace std; const int mo=int(1e9+7); int n,k,f[2010][2010][2],ans; void work() { scanf("%d %d",&n,&k); f[0][0][1]=1; for (int i=0; i<n; i++) for (int j=i; ~j; j--) { f[i][j][1]=(f[i][j][1]+f[i][j][0])%mo; if (j) f[i][j-1][0]=(f[i][j-1][0]+f[i][j][0])%mo; f[i+1][j][0]=(f[i+1][j][0]+f[i][j][1])%mo; f[i+1][j+1][1]=(f[i+1][j+1][1]+f[i][j][1])%mo; } ans=f[n][n-k][0]; for (int i=1; i<=n-k-1; i++) ans=2*ans%mo; printf("%d",ans); } int main() { work(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Solitaire |
User | YMDragon |
Language | C++14 (GCC 5.4.1) |
Score | 1200 |
Code Size | 564 Byte |
Status | AC |
Exec Time | 24 ms |
Memory | 30208 KB |
Compile Error
./Main.cpp: In function ‘void work()’: ./Main.cpp:9:22: 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 | 24 ms | 30208 KB |
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 9 ms | 17280 KB |
03.txt | AC | 1 ms | 384 KB |
04.txt | AC | 2 ms | 2944 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 | 384 KB |
09.txt | AC | 22 ms | 29568 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 1 ms | 256 KB |
12.txt | AC | 22 ms | 29568 KB |
13.txt | AC | 2 ms | 2944 KB |
14.txt | AC | 24 ms | 29952 KB |
15.txt | AC | 4 ms | 9088 KB |
16.txt | AC | 24 ms | 30208 KB |
17.txt | AC | 24 ms | 30208 KB |
18.txt | AC | 24 ms | 30208 KB |
19.txt | AC | 24 ms | 30208 KB |
20.txt | AC | 24 ms | 30208 KB |
21.txt | AC | 1 ms | 256 KB |
22.txt | AC | 24 ms | 30208 KB |
23.txt | AC | 24 ms | 30208 KB |