# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1055866 | 2024-08-13T06:09:32 Z | 김은성(#11066) | Summer Driving (CCO24_day1problem3) | C++17 | 153 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; if(a >= n){ pos[min(n, b+1)]--; pos[0]++; } for(k=1; a*k<=n; k++){ if(a*k + (k-1)*b + a >= n){ pos[min(n, a*k + k*b + 1)]--; pos[max(0, a*k-b)]++; } else{ pos[min(n, a*k + (k-1)*b)]--; pos[max(0, a*k-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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 104 ms | 32592 KB | Output is correct |
2 | Correct | 109 ms | 32596 KB | Output is correct |
3 | Correct | 116 ms | 33272 KB | Output is correct |
4 | Correct | 109 ms | 33360 KB | Output is correct |
5 | Correct | 6 ms | 14424 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 153 ms | 60244 KB | Output is correct |
2 | Correct | 151 ms | 60240 KB | Output is correct |
3 | Correct | 105 ms | 59988 KB | Output is correct |
4 | Correct | 106 ms | 59972 KB | Output is correct |
5 | Incorrect | 142 ms | 58528 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 14428 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 14428 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 20560 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 14428 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 104 ms | 32592 KB | Output is correct |
2 | Correct | 109 ms | 32596 KB | Output is correct |
3 | Correct | 116 ms | 33272 KB | Output is correct |
4 | Correct | 109 ms | 33360 KB | Output is correct |
5 | Correct | 6 ms | 14424 KB | Output is correct |
6 | Correct | 153 ms | 60244 KB | Output is correct |
7 | Correct | 151 ms | 60240 KB | Output is correct |
8 | Correct | 105 ms | 59988 KB | Output is correct |
9 | Correct | 106 ms | 59972 KB | Output is correct |
10 | Incorrect | 142 ms | 58528 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |