Submission #1082862


Source Code Expand

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
const in mdl=1000000007;
VVI wy;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n,k;
  cin>>n>>k;
  wy.resize(k+1,VI(n+1,0));
  wy[0][n]=1;
  for(in i=1;i<=k;++i){
    for(in j=n-1;j>=0;--j){
      wy[i][j]=wy[i][j+1]+wy[i-1][j+1];
    }
    forn(j,n){
      if(n-j>=i)
	wy[i][j]+=wy[i-1][j];
      wy[i][j]%=mdl;
    }
    if(i<k){
      wy[i][0]=0;
    }
  }
  in rs=wy[k][0];
  if(k<n){
    forn(z,n-k-1){
      rs*=2;
      rs%=mdl;
    }
  }
  cout<<rs<<endl;
  return 0;
}

Submission Info

Submission Time
Task F - Solitaire
User w4yneb0t
Language C++14 (GCC 5.4.1)
Score 1200
Code Size 989 Byte
Status AC
Exec Time 56 ms
Memory 31616 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 3 ms 256 KB
00_example_02.txt AC 3 ms 256 KB
00_example_03.txt AC 30 ms 16000 KB
01.txt AC 3 ms 256 KB
02.txt AC 15 ms 7296 KB
03.txt AC 3 ms 256 KB
04.txt AC 3 ms 384 KB
05.txt AC 3 ms 256 KB
06.txt AC 3 ms 256 KB
07.txt AC 3 ms 256 KB
08.txt AC 3 ms 256 KB
09.txt AC 46 ms 25216 KB
10.txt AC 3 ms 256 KB
11.txt AC 3 ms 256 KB
12.txt AC 48 ms 26240 KB
13.txt AC 3 ms 384 KB
14.txt AC 20 ms 10624 KB
15.txt AC 6 ms 2304 KB
16.txt AC 22 ms 11008 KB
17.txt AC 18 ms 8832 KB
18.txt AC 36 ms 19456 KB
19.txt AC 32 ms 17152 KB
20.txt AC 15 ms 7552 KB
21.txt AC 2 ms 256 KB
22.txt AC 56 ms 31616 KB
23.txt AC 3 ms 256 KB