Submission #147002

#TimeUsernameProblemLanguageResultExecution timeMemory
147002dongwon0427Journey (NOI18_journey)C++14
69 / 100
2041 ms41108 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; int n,m,h; pii graph[10005][105]; ll num[10005][405]; int main() { ios_base::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++) cin>>graph[i][j].first>>graph[i][j].second; } num[0][0] = 1; for(int i=0;i<n-1;i++) { for(int j=0;j<h;j++) { if(graph[i][j].first <= i) continue; int nxt = graph[i][j].first; int day = graph[i][j].second; for(int k=day;k<m;k++) { for(int l=k;l<m;l++) { num[nxt][l] += num[i][l-k]; if(num[nxt][l] > 500000001) num[nxt][l] = 500000001; } //if(num > 50000001) num = 50000001; } } } for(int i=0;i<m;i++) cout<<num[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...