This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+11, MAXM = 401;
int dp[MAXN][MAXM];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N,M,H; cin >> N >> M >> H;
dp[0][0] = 1;
for(int i = 0;i<N-1;++i){
for(int j = 0;j<MAXM-1;++j) dp[i][j+1] = min(dp[i][j+1]+dp[i][j],500000001);
for(int j = 0;j<H;++j){
int x,t; cin >> x >> t;
if(x <= i) continue;
for(int k = 0;k+t<MAXM;++k) dp[x][k+t] = min(dp[i][k]+dp[x][k+t],500000001);
}
}
for(int i = 0;i<M;++i){
cout << dp[N-1][i] << " ";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |