Submission #2374968
Source Code Expand
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e15+1);
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
int n,m,k,i,j;cin>>n>>m>>k;
llint dp[4001]={0};//1の個数
llint ans=0;
for(i=0;i<(n+m-1)/(k-1);i++){
//下からdp
//int wa=(i+1)*(k-1)+1;cerr<<wa<<" ";
llint ddp[4001]={0};
for(j=0;j<=i*(k-1);j++){
for(int a=0;a<k;a++){//前回からのア
//if(j+a>m||wa-(j+a)>n){continue;}
ddp[j+a]+=dp[j];
}
}
for(int a=1;a<=(i+1)*(k-1);a++){ddp[a]++;}
for(j=0;j<=(i+1)*(k-1)+1;j++){dp[j]=ddp[j]%mod;}
}
cout<<dp[m]<<endl;
RE;
}
Submission Info
Submission Time |
|
Task |
E - Eternal Average |
User |
WA_TLE |
Language |
C++14 (GCC 5.4.1) |
Score |
1600 |
Code Size |
2422 Byte |
Status |
AC |
Exec Time |
36 ms |
Memory |
256 KB |
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 |
36 ms |
256 KB |
03.txt |
AC |
1 ms |
256 KB |
04.txt |
AC |
1 ms |
256 KB |
05.txt |
AC |
22 ms |
256 KB |
06.txt |
AC |
5 ms |
256 KB |
07.txt |
AC |
5 ms |
256 KB |
08.txt |
AC |
2 ms |
256 KB |
09.txt |
AC |
11 ms |
256 KB |
10.txt |
AC |
10 ms |
256 KB |
11.txt |
AC |
5 ms |
256 KB |
12.txt |
AC |
4 ms |
256 KB |
13.txt |
AC |
7 ms |
256 KB |
14.txt |
AC |
4 ms |
256 KB |
15.txt |
AC |
7 ms |
256 KB |
16.txt |
AC |
1 ms |
256 KB |
17.txt |
AC |
5 ms |
256 KB |
18.txt |
AC |
4 ms |
256 KB |
19.txt |
AC |
12 ms |
256 KB |
20.txt |
AC |
11 ms |
256 KB |
21.txt |
AC |
1 ms |
256 KB |
22.txt |
AC |
12 ms |
256 KB |
23.txt |
AC |
8 ms |
256 KB |
24.txt |
AC |
7 ms |
256 KB |
s1.txt |
AC |
1 ms |
256 KB |
s2.txt |
AC |
1 ms |
256 KB |
s3.txt |
AC |
1 ms |
256 KB |