# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1055841 | 2024-08-13T05:58:25 Z | 김은성(#11066) | Summer Driving (CCO24_day1problem3) | C++17 | 204 ms | 60244 KB |
#include <bits/stdc++.h> using namespace std; vector<int> graph[300009]; int par[300009], depth[300009]; vector<int> child[300009]; int pos[1000009]; void settree(int v){ for(int u: graph[v]){ if(par[v] == u) continue; par[u] = v; child[v].push_back(u); depth[u] = depth[v] + 1; settree(u); } } int main(){ int n, r, a, b, i, u, v; scanf("%d %d %d %d", &n, &r, &a, &b); for(i=1; i<n; i++){ scanf("%d %d", &u, &v); graph[u].push_back(v); graph[v].push_back(u); } settree(r); int k, l; for(k=0; a*k<=n; k++){ for(l=0; l<k && l<a; l++){ int p = a*k + b*l; if(p >= n) continue; if(p+a < n){ pos[max(0, p-b)]++; pos[p]--; } else{ pos[max(0, p-b)]++; pos[min(n, p+b)]--; } } } for(i=1; i<n; i++) pos[i] += pos[i-1]; for(i=1; i<=n; i++){ if(pos[depth[i]] > 0){ printf("%d\n", i); return 0; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 161 ms | 32592 KB | Output is correct |
2 | Incorrect | 116 ms | 32532 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 204 ms | 60244 KB | Output is correct |
2 | Correct | 174 ms | 60240 KB | Output is correct |
3 | Correct | 93 ms | 59988 KB | Output is correct |
4 | Correct | 112 ms | 59988 KB | Output is correct |
5 | Incorrect | 193 ms | 58656 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 14424 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 14424 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 31 ms | 20428 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 14424 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 161 ms | 32592 KB | Output is correct |
2 | Incorrect | 116 ms | 32532 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |