# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
309828 | 2020-10-04T15:38:56 Z | emaborevkovic | 기지국 (IOI20_stations) | C++14 | 3000 ms | 2097156 KB |
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define pb push_back const int N = 1005; vector <int> ls[N]; vector <int> res; int depth[N], podstablo[N]; int dfs (int x, int d, int p) { int suma = 0; depth[x] = d; for (int i=0;i<ls[x].size();i++) { if (ls[x][i] == p) continue; suma += dfs(ls[x][i], d+1, x); } return podstablo[x] = suma+1; } void oznaci (int x, int l, int r, int p) { if (depth[x] % 2 == 0) { res[x] = l; l++; } else { res[x] = r; r--; } for (int i=0;i<ls[x].size();i++) { if (ls[x][i] == p) continue; oznaci(ls[x][i], l, l+podstablo[ls[x][i]]-1, x); l += podstablo[ls[x][i]]; } } vector <int> label (int n, int k, vector <int> u, vector <int> v) { res.resize(n); for (int i=0;i<n-1;i++) { ls[u[i]].pb(v[i]); ls[v[i]].pb(u[i]); } dfs (0, 0, 0); oznaci(0, 0, n-1, 0); return res; } int find_next_station(int s, int t, vector <int> c) { int n = c.size(); if (s == 0) { for (int i=0;i<n;i++) { if (c[i] >= t) return c[i]; } } if (n == 1) return c[0]; if (s < c[0]) { if (t < s || t > c[n-2]) return c[n-1]; for (int i=0;i<n-1;i++) { if (c[i] >= t) return c[i]; } } if (t < c[1] || t > s) return c[0]; for (int i=n-1;i>0;i--) { if (t >= c[i]) return c[i]; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1326 ms | 2097152 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3048 ms | 512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1403 ms | 2097156 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 910 ms | 612 KB | Output is correct |
2 | Runtime error | 1168 ms | 2097156 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2241 ms | 2097152 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |