Submission #4029038


Source Code Expand

#include<bits/stdc++.h>
#define N (2009)
#define MOD (1000000007)
using namespace std;

int n,k,ans,f[N][N],s[N];

int main()
{
	cin>>n>>k;
	if (k==1) {puts("1"); return 0;}
	for (int i=2; i<=n; ++i) f[1][i]=1;
	for (int i=n; i>=1; --i) s[i]=s[i+1]+f[1][i];
	for (int i=2; i<=k-1; ++i)
	{
		for (int j=1; j<=n-i+1; ++j) f[i][j]=s[j];
		s[n]=f[i][n];
		for (int j=n; j>=1; --j) s[j]=(s[j+1]+f[i][j])%MOD;
	}
	for (int i=2; i<=n; ++i) (ans+=f[k-1][i])%=MOD;
	for (int i=1; i<=n-k-1; ++i) (ans*=2)%=MOD; 
	cout<<ans<<endl;
}

Submission Info

Submission Time
Task F - Solitaire
User Refun
Language C++14 (GCC 5.4.1)
Score 0
Code Size 545 Byte
Status WA
Exec Time 30 ms
Memory 15360 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1200
Status
AC × 3
AC × 24
WA × 2
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 16 ms 8448 KB
01.txt AC 1 ms 256 KB
02.txt AC 9 ms 8320 KB
03.txt AC 1 ms 384 KB
04.txt AC 2 ms 768 KB
05.txt AC 1 ms 256 KB
06.txt WA 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 384 KB
09.txt AC 25 ms 14592 KB
10.txt AC 1 ms 256 KB
11.txt AC 1 ms 256 KB
12.txt AC 26 ms 14592 KB
13.txt AC 1 ms 512 KB
14.txt AC 12 ms 6400 KB
15.txt AC 4 ms 3712 KB
16.txt AC 12 ms 6400 KB
17.txt AC 10 ms 6400 KB
18.txt AC 20 ms 10496 KB
19.txt AC 18 ms 10496 KB
20.txt AC 9 ms 4352 KB
21.txt AC 1 ms 256 KB
22.txt AC 30 ms 15360 KB
23.txt WA 1 ms 256 KB