# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1039607 | 2024-07-31T05:25:58 Z | 김은성(#10990) | Petrol stations (CEOI24_stations) | C++17 | 3500 ms | 10152 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<pair<int, int> > graph[70009]; bool ch[70009]; ll ans[70009]; int cap; int dfs(int v, int fuel){ ch[v] = 1; int sz = 1, i; for(i=0; i<graph[v].size(); i++){ int u = graph[v][i].first; if(ch[u]) continue; if(graph[v][i].second > fuel){ int temp = dfs(u, cap - graph[v][i].second); sz += temp; ans[v] += temp; } else sz += dfs(u, fuel - graph[v][i].second); } return sz; } int main(){ int n, i, a, b, c; scanf("%d %d", &n, &cap); for(i=1; i<n; i++){ scanf("%d %d %d",&a, &b, &c); graph[a].push_back(make_pair(b, c)); graph[b].push_back(make_pair(a, c)); } for(i=0; i<n; i++){ memset(ch, 0, sizeof(ch)); dfs(i, cap); } for(i=0; i<n; i++) printf("%lld\n", ans[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2140 KB | Output is correct |
2 | Correct | 1 ms | 2140 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2140 KB | Output is correct |
2 | Correct | 1 ms | 2140 KB | Output is correct |
3 | Correct | 7 ms | 2140 KB | Output is correct |
4 | Correct | 12 ms | 2200 KB | Output is correct |
5 | Correct | 9 ms | 2140 KB | Output is correct |
6 | Correct | 17 ms | 2260 KB | Output is correct |
7 | Correct | 14 ms | 2140 KB | Output is correct |
8 | Correct | 1 ms | 2088 KB | Output is correct |
9 | Correct | 9 ms | 2136 KB | Output is correct |
10 | Correct | 9 ms | 2140 KB | Output is correct |
11 | Correct | 10 ms | 2216 KB | Output is correct |
12 | Correct | 9 ms | 2212 KB | Output is correct |
13 | Correct | 10 ms | 2208 KB | Output is correct |
14 | Correct | 7 ms | 2140 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2136 KB | Output is correct |
2 | Execution timed out | 3575 ms | 10152 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2140 KB | Output is correct |
2 | Correct | 1 ms | 2140 KB | Output is correct |
3 | Correct | 1 ms | 2136 KB | Output is correct |
4 | Execution timed out | 3575 ms | 10152 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2140 KB | Output is correct |
2 | Correct | 1 ms | 2140 KB | Output is correct |
3 | Execution timed out | 3536 ms | 5660 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2140 KB | Output is correct |
2 | Correct | 1 ms | 2140 KB | Output is correct |
3 | Execution timed out | 3536 ms | 5660 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2140 KB | Output is correct |
2 | Correct | 1 ms | 2140 KB | Output is correct |
3 | Correct | 7 ms | 2140 KB | Output is correct |
4 | Correct | 12 ms | 2200 KB | Output is correct |
5 | Correct | 9 ms | 2140 KB | Output is correct |
6 | Correct | 17 ms | 2260 KB | Output is correct |
7 | Correct | 14 ms | 2140 KB | Output is correct |
8 | Correct | 1 ms | 2088 KB | Output is correct |
9 | Correct | 9 ms | 2136 KB | Output is correct |
10 | Correct | 9 ms | 2140 KB | Output is correct |
11 | Correct | 10 ms | 2216 KB | Output is correct |
12 | Correct | 9 ms | 2212 KB | Output is correct |
13 | Correct | 10 ms | 2208 KB | Output is correct |
14 | Correct | 7 ms | 2140 KB | Output is correct |
15 | Correct | 1 ms | 2136 KB | Output is correct |
16 | Execution timed out | 3575 ms | 10152 KB | Time limit exceeded |
17 | Halted | 0 ms | 0 KB | - |