# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
309804 | 2020-10-04T14:51:03 Z | tjdgus4384 | 기지국 (IOI20_stations) | C++14 | 922 ms | 872 KB |
#include<bits/stdc++.h> #include "stations.h" using namespace std; bool visited[1001]; vector<int> path[1001]; int num1[1001], num2[1001]; int dfs1(int x, int cnt){ num1[x] = cnt; cnt++; for(int i = 0;i < path[x].size();i++){ if(visited[path[x][i]]) continue; visited[path[x][i]] = true; cnt = dfs1(path[x][i], cnt); } return cnt; } int dfs2(int x){ int ret = num1[x]; for(int i = 0;i < path[x].size();i++){ if(visited[path[x][i]]) continue; visited[path[x][i]] = true; ret = max(ret, dfs2(path[x][i])); } return num2[x] = ret; } vector<int> label(int n, int k, vector<int> u, vector<int> v){ for(int i = 0;i < n;i++){ path[u[i]].push_back(v[i]); path[v[i]].push_back(u[i]); } visited[0] = true; dfs1(0, 0); for(int i = 0;i < n;i++) visited[i] = false; visited[0] = true; dfs2(0); vector<int> ret; for(int i = 0;i < n;i++){ ret.push_back(num1[i]*1000+num2[i]); } return ret; } int find_next_station(int s, int t, vector<int> c){ int num2s = s%1000, num2t = t%1000; int num1s = (s-num2s)/1000, num1t = (t-num2t)/1000; for(int i = 1;i < c.size();i++){ num2[i] = c[i]%1000; num1[i] = (c[i]-num2[i])/1000; } if(num1t > num1s && num1t <= num2s){ int s = 1, e = c.size() - 1; while(s < e){ int mid = (s+e+1)/2; if(num1[mid] > num1t) e = mid-1; else s = mid; } return c[s]; } else return c[0]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 768 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 922 ms | 872 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |