Submission #1083104


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORD(i,b,a) for (int i = (int)(b) - 1; i >= a; --i)
#define REP(i,N) FOR(i,0,N)
#define st first
#define nd second
#define pb push_back

typedef pair<int, int> PII;
typedef long long LL;

const int MOD = 1000000007;
LL DP[2005][2005];

int main() {
  int N, K;
  scanf("%d%d", &N, &K);
  FOR(i,1,N-K+2) DP[N-K+1][i] = 1;
  FOR(i,N-K+2,N+1) {
    LL su = 0;
    REP(j,i+1) {
      su += DP[i-1][j];
      DP[i][j] = su % MOD;
    }
  }
  LL res = DP[N][N];
  REP(i,max(0, N-K-1)) res = 2 * res % MOD;
  printf("%lld\n", res);
}

Submission Info

Submission Time
Task F - Solitaire
User voover
Language C++14 (GCC 5.4.1)
Score 1200
Code Size 664 Byte
Status AC
Exec Time 27 ms
Memory 22912 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:19:24: 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
AC × 3
AC × 26
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 2 ms 256 KB
00_example_02.txt AC 2 ms 256 KB
00_example_03.txt AC 18 ms 14976 KB
01.txt AC 3 ms 256 KB
02.txt AC 11 ms 7808 KB
03.txt AC 3 ms 384 KB
04.txt AC 3 ms 768 KB
05.txt AC 2 ms 256 KB
06.txt AC 2 ms 256 KB
07.txt AC 2 ms 256 KB
08.txt AC 3 ms 384 KB
09.txt AC 24 ms 20224 KB
10.txt AC 3 ms 256 KB
11.txt AC 3 ms 256 KB
12.txt AC 24 ms 20352 KB
13.txt AC 3 ms 512 KB
14.txt AC 14 ms 10624 KB
15.txt AC 6 ms 3328 KB
16.txt AC 14 ms 10880 KB
17.txt AC 12 ms 8832 KB
18.txt AC 21 ms 17408 KB
19.txt AC 19 ms 15744 KB
20.txt AC 11 ms 7552 KB
21.txt AC 2 ms 256 KB
22.txt AC 27 ms 22912 KB
23.txt AC 3 ms 256 KB