Submission #4029106


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;
	f[0][n+1]=1; s[n+1]=1;
	for (int i=n; i>=1; --i) s[i]=s[i+1]+f[0][i];
	for (int i=1; i<=k-1; ++i)
	{
		for (int j=1; j<=n-i+1; ++j) f[i][j]=s[j];
		s[n+1]=f[i][n+1];
		for (int j=n; j>=1; --j) s[j]=(s[j+1]+f[i][j])%MOD;
	}
	for (int i=2; i<=n+1; ++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 1200
Code Size 501 Byte
Status AC
Exec Time 21 ms
Memory 15360 KB

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 1 ms 256 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt AC 12 ms 8448 KB
01.txt AC 1 ms 256 KB
02.txt AC 7 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 AC 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 384 KB
09.txt AC 17 ms 14592 KB
10.txt AC 1 ms 256 KB
11.txt AC 1 ms 256 KB
12.txt AC 18 ms 14592 KB
13.txt AC 1 ms 512 KB
14.txt AC 9 ms 6400 KB
15.txt AC 4 ms 3712 KB
16.txt AC 9 ms 6400 KB
17.txt AC 8 ms 6400 KB
18.txt AC 14 ms 10496 KB
19.txt AC 13 ms 10496 KB
20.txt AC 6 ms 4352 KB
21.txt AC 1 ms 256 KB
22.txt AC 21 ms 15360 KB
23.txt AC 1 ms 256 KB