# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
586420 | krit3379 | Journey (NOI18_journey) | C++17 | 146 ms | 6456 KiB |
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;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define N 10005
int dp[405][N];
vector<pair<int,int>> g[N];
int main(){
int n,m,h,i,j,a,w;
scanf("%d %d %d",&n,&m,&h);
for(i=0;i<n-1;i++){
for(j=0;j<h;j++){
scanf("%d %d",&a,&w);
if(a<=i)continue;
g[i].push_back({a,w});
}
}
dp[0][0]=1;
for(j=0;j<m;j++){
for(i=0;i<n-1;i++){
dp[j+1][i]=min(dp[j+1][i]+dp[j][i],500000001);
for(auto [x,w]:g[i])if(j+w<m)dp[j+w][x]=min(dp[j+w][x]+dp[j][i],500000001);
}
}
for(i=0;i<m;i++)printf("%d ",dp[i][n-1]);
return 0;
}
Compilation message (stderr)
# | 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... |