Submission #854264

#TimeUsernameProblemLanguageResultExecution timeMemory
854264annabeth9680Journey (NOI18_journey)C++17
100 / 100
93 ms18516 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...