# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
791179 | 2023-07-23T13:54:15 Z | Pablo_No | 기지국 (IOI20_stations) | C++17 | 720 ms | 552 KB |
#include "stations.h" #include <algorithm> #include <vector> using namespace std; vector<int> col; vector<vector<int>> g; int dfsfd(int v, int p, int d) { if(g[v].size() == d) { return v; } for(int u : g[v]) if(u != p) { int x = dfsfd(u, v, d); if(x != -1) { return x; } } return -1; } void dfs(int v, int p, int d) { col[v] = d-1; int ns = 0; for(int u : g[v]) if(u != p) { dfs(u, v, 2*d+ns); ns++; } } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { g.assign(n, vector<int>(0)); col.resize(n); for(int i = 0; i < n-1; i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } if(dfsfd(1, -1, 2) != -1) dfs(dfsfd(1, -1, 2), -1, 1); else dfs(dfsfd(1, -1, 1), -1, 1); return col; } int find_next_station(int s, int t, std::vector<int> c) { sort(c.begin(), c.end()); int ts = s+1; int tt = t+1; int t1 = 2*ts; int t2 = 2*ts+1; while(tt && tt != t1 && tt != t2) { tt /= 2; } if(tt == t1) return t1-1; if(tt == t2) return t2-1; return ts/2-1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 416 KB | Invalid labels (values out of range). scenario=2, k=1000, vertex=2, label=-1 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 347 ms | 552 KB | Output is correct |
2 | Correct | 397 ms | 544 KB | Output is correct |
3 | Correct | 672 ms | 492 KB | Output is correct |
4 | Correct | 540 ms | 416 KB | Output is correct |
5 | Correct | 410 ms | 492 KB | Output is correct |
6 | Correct | 309 ms | 488 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 464 KB | Invalid labels (values out of range). scenario=1, k=1000000, vertex=0, label=-1 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 628 ms | 492 KB | Output is correct |
2 | Correct | 519 ms | 420 KB | Output is correct |
3 | Correct | 574 ms | 492 KB | Output is correct |
4 | Correct | 1 ms | 496 KB | Output is correct |
5 | Correct | 3 ms | 492 KB | Output is correct |
6 | Correct | 0 ms | 492 KB | Output is correct |
7 | Correct | 464 ms | 416 KB | Output is correct |
8 | Correct | 720 ms | 416 KB | Output is correct |
9 | Correct | 469 ms | 420 KB | Output is correct |
10 | Correct | 465 ms | 492 KB | Output is correct |
11 | Incorrect | 4 ms | 492 KB | Wrong query response. |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 464 KB | Invalid labels (values out of range). scenario=1, k=1000000000, vertex=0, label=-1 |
2 | Halted | 0 ms | 0 KB | - |