# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
924062 |
2024-02-08T10:52:01 Z |
pcc |
Journey (NOI18_journey) |
C++14 |
|
1 ms |
2652 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 1e4+10;
const int mxm = 410;
const ll inf = 5e8+1;
ll cnt[mxn][mxm];
ll dist[mxn];
vector<pii> paths[mxn],rg[mxn];
int n,m,h;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>m>>h;
for(int i = 0;i<n-1;i++){
for(int j = 0;j<h;j++){
int a,b;
cin>>a>>b;
paths[i].push_back({a,b});
rg[i].push_back({a,b});
}
}
cnt[0][0] = 1;
for(int i = 0;i<n;i++){
for(auto nxt:paths[i]){
ll pre = 0;
for(int j = 0;j+nxt.sc<m;j++){
pre = min(pre+cnt[i][j],inf);
cnt[nxt.fs][j+nxt.sc] = min(cnt[nxt.fs][j+nxt.sc]+pre,inf);
}
}
}
for(int i = 0;i<m;i++)cout<<cnt[n-1][i]<<' ';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |