Submission #1076401
Source Code Expand
#include<stdio.h> #include<algorithm> using namespace std; int n, m, K, L, S[30010]; long long D[4010][2010], Mod = 1000000007, Res; int main(){ scanf("%d%d%d",&n,&m,&K); if(n>m)swap(n,m); L = (n+m-1)/(K-1); int i, j; for(i=0;i<=n;i++)D[0][i] = 1; for(i=1;i<=L;i++){ for(j=0;j<=n;j++){ D[i][j] = D[i-1][j]; if(j>=K) D[i][j] = (D[i][j]-D[i-1][j-K]+Mod)%Mod; } for(j=1;j<=n;j++){ D[i][j] = (D[i][j]+D[i][j-1])%Mod; } } int c = L; for(i=n;i>=1;i-=(K-1)){ Res = (Res + D[c][i])%Mod; if(i)Res = (Res - D[c][i-1] + Mod)%Mod; // Res = (Res + Mod - S[i])%Mod; c--; } printf("%lld\n",Res); }
Submission Info
Submission Time | |
---|---|
Task | E - Eternal Average |
User | ainta |
Language | C++14 (GCC 5.4.1) |
Score | 1600 |
Code Size | 753 Byte |
Status | AC |
Exec Time | 272 ms |
Memory | 62976 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:7:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d%d",&n,&m,&K); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1600 / 1600 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 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, 24.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 272 ms | 62976 KB |
03.txt | AC | 1 ms | 128 KB |
04.txt | AC | 1 ms | 128 KB |
05.txt | AC | 137 ms | 31616 KB |
06.txt | AC | 4 ms | 2816 KB |
07.txt | AC | 4 ms | 2176 KB |
08.txt | AC | 2 ms | 512 KB |
09.txt | AC | 10 ms | 2176 KB |
10.txt | AC | 8 ms | 1664 KB |
11.txt | AC | 2 ms | 256 KB |
12.txt | AC | 2 ms | 256 KB |
13.txt | AC | 4 ms | 768 KB |
14.txt | AC | 2 ms | 384 KB |
15.txt | AC | 4 ms | 768 KB |
16.txt | AC | 1 ms | 128 KB |
17.txt | AC | 2 ms | 256 KB |
18.txt | AC | 3 ms | 768 KB |
19.txt | AC | 17 ms | 10240 KB |
20.txt | AC | 37 ms | 9472 KB |
21.txt | AC | 1 ms | 128 KB |
22.txt | AC | 36 ms | 8064 KB |
23.txt | AC | 6 ms | 1280 KB |
24.txt | AC | 5 ms | 1024 KB |
s1.txt | AC | 1 ms | 128 KB |
s2.txt | AC | 1 ms | 128 KB |
s3.txt | AC | 2 ms | 256 KB |