# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
371183 |
2021-02-26T04:10:02 Z |
evn |
Journey (NOI18_journey) |
C++14 |
|
2000 ms |
35948 KB |
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
typedef long long ll;
typedef pair<int, int> pii;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll dp[10005][405];
vector<pair<int,long>> adj[10005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m, h;
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;
if(a <= i)continue;
adj[i].pb({a,b});
}
}
dp[0][0] = 1;
for(int i = 0; i < n;i ++){
for(int j = 0;j <= m; j++){
for(auto it : adj[i]){
ll weight = it.s;
while(j + weight <= m){
dp[it.f][j+weight]+= dp[i][j];
dp[it.f][j+weight] = min(dp[it.f][j+weight], 500000001LL);
weight++;
}
}
/**
if(j != m){
dp[i][j+1] += dp[i][j];
}**/
}
}
for(int i = 0; i < m; i++){
cout << min(500000001LL, dp[n-1][i]) << " ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
620 KB |
Output is correct |
2 |
Correct |
1 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
620 KB |
Output is correct |
2 |
Correct |
1 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
620 KB |
Output is correct |
2 |
Correct |
1 ms |
620 KB |
Output is correct |
3 |
Correct |
1 ms |
620 KB |
Output is correct |
4 |
Correct |
1 ms |
620 KB |
Output is correct |
5 |
Correct |
15 ms |
876 KB |
Output is correct |
6 |
Correct |
15 ms |
1004 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
620 KB |
Output is correct |
2 |
Correct |
1 ms |
620 KB |
Output is correct |
3 |
Correct |
1 ms |
620 KB |
Output is correct |
4 |
Correct |
1 ms |
620 KB |
Output is correct |
5 |
Correct |
15 ms |
876 KB |
Output is correct |
6 |
Correct |
15 ms |
1004 KB |
Output is correct |
7 |
Correct |
176 ms |
35948 KB |
Output is correct |
8 |
Correct |
710 ms |
21996 KB |
Output is correct |
9 |
Correct |
1062 ms |
3492 KB |
Output is correct |
10 |
Execution timed out |
2073 ms |
5228 KB |
Time limit exceeded |