Submission #1084748
Source Code Expand
#include <cstdio> #include <cstdlib> #include <algorithm> #include <vector> #include <cstring> #define SIZE 2005 #define MOD 1000000007 using namespace std; typedef long long int ll; ll dp[SIZE][SIZE]; int L; void make() { ll r1=1; for(int i=0;i<L-2;i++) r1=r1*2LL%MOD; for(int i=1;i<=L;i++) dp[L][i]=r1; for(int i=L+1;i<SIZE;i++) { ll sum=0; for(int j=i;j>=1;j--) { dp[i][j]=dp[i-1][max(1,j-1)]; if(j<=i-2) { sum+=dp[i-1][j]; if(sum>=MOD) sum-=MOD; dp[i][j]+=sum; if(dp[i][j]>=MOD) dp[i][j]-=MOD; } } //if(i<=5) {for(int j=1;j<=i;j++) printf("%d ",dp[i][j]);puts("");} } } int main() { int n,k; scanf("%d %d",&n,&k); L=n-k+1; make(); printf("%lld\n",dp[n][1]); return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Solitaire |
User | yutaka1999 |
Language | C++14 (GCC 5.4.1) |
Score | 1200 |
Code Size | 772 Byte |
Status | AC |
Exec Time | 35 ms |
Memory | 22784 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:40:22: 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 | 35 ms | 22784 KB |
00_example_02.txt | AC | 34 ms | 22784 KB |
00_example_03.txt | AC | 24 ms | 14976 KB |
01.txt | AC | 35 ms | 22784 KB |
02.txt | AC | 33 ms | 21760 KB |
03.txt | AC | 35 ms | 22784 KB |
04.txt | AC | 34 ms | 22528 KB |
05.txt | AC | 35 ms | 22784 KB |
06.txt | AC | 34 ms | 22784 KB |
07.txt | AC | 34 ms | 22784 KB |
08.txt | AC | 35 ms | 22784 KB |
09.txt | AC | 33 ms | 21760 KB |
10.txt | AC | 35 ms | 22784 KB |
11.txt | AC | 35 ms | 22784 KB |
12.txt | AC | 34 ms | 22528 KB |
13.txt | AC | 34 ms | 22400 KB |
14.txt | AC | 18 ms | 10880 KB |
15.txt | AC | 34 ms | 22656 KB |
16.txt | AC | 18 ms | 10880 KB |
17.txt | AC | 15 ms | 8832 KB |
18.txt | AC | 28 ms | 17408 KB |
19.txt | AC | 25 ms | 15744 KB |
20.txt | AC | 13 ms | 7552 KB |
21.txt | AC | 34 ms | 22784 KB |
22.txt | AC | 35 ms | 22784 KB |
23.txt | AC | 1 ms | 256 KB |