Submission #1426866
Source Code Expand
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn = 2009; const int MOD = 1000000007; int f[maxn][maxn]; int N, K, ans; int main(){ scanf("%d%d", &N, &K); f[0][N+1] = 1; for (int i=1; i<=K; i++){ f[i][N-i+1] = (f[i-1][N-i+2] + f[i-1][N-i+1]) % MOD; for (int j=N-i; j>=1; j--) f[i][j] = (f[i-1][j] + f[i][j+1]) % MOD; } ans = (f[K][1] - f[K-1][1] + MOD) % MOD; for (int i=1; i<=N-K-1; i++) ans = ans*2 % MOD; printf("%d\n", ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Solitaire |
User | Cyanic |
Language | C++14 (GCC 5.4.1) |
Score | 1200 |
Code Size | 520 Byte |
Status | AC |
Exec Time | 12 ms |
Memory | 15232 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:12:23: 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 | 128 KB |
00_example_02.txt | AC | 1 ms | 128 KB |
00_example_03.txt | AC | 8 ms | 8320 KB |
01.txt | AC | 1 ms | 128 KB |
02.txt | AC | 5 ms | 8320 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 640 KB |
05.txt | AC | 1 ms | 128 KB |
06.txt | AC | 1 ms | 128 KB |
07.txt | AC | 1 ms | 128 KB |
08.txt | AC | 1 ms | 256 KB |
09.txt | AC | 10 ms | 14464 KB |
10.txt | AC | 1 ms | 128 KB |
11.txt | AC | 1 ms | 256 KB |
12.txt | AC | 10 ms | 14464 KB |
13.txt | AC | 1 ms | 384 KB |
14.txt | AC | 6 ms | 6272 KB |
15.txt | AC | 2 ms | 3712 KB |
16.txt | AC | 6 ms | 6272 KB |
17.txt | AC | 6 ms | 6272 KB |
18.txt | AC | 9 ms | 10368 KB |
19.txt | AC | 9 ms | 10368 KB |
20.txt | AC | 5 ms | 4224 KB |
21.txt | AC | 1 ms | 128 KB |
22.txt | AC | 12 ms | 15232 KB |
23.txt | AC | 1 ms | 128 KB |