| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1025546 | HappyCapybara | 기지국 (IOI20_stations) | C++17 | 639 ms | 684 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include<bits/stdc++.h>
using namespace std;
int cnt;
vector<vector<int>> g;
vector<int> in, out, d;
void dfs(int cur, int dep){
if (d[cur] != -1) return;
d[cur] = dep;
in[cur] = cnt++;
for (int next : g[cur]) dfs(next, dep+1);
out[cur] = cnt++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v){
g.resize(n);
for (int i=0; i<n-1; i++){
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
}
in.resize(n); out.resize(n); d.resize(n, -1);
cnt = 0;
dfs(0, 0);
/*for (int x : in) cout << x << " ";
cout << "\n";
for (int x : out) cout << x << " ";
cout << "\n";*/
vector<int> l(n, 1234);
for (int i=0; i<n; i++){
if (d[i] % 2) l[i] = out[i];
else l[i] = in[i];
}
return l;
vector<int> w = l;
sort(w.begin(), w.end());
unordered_map<int,int> m;
for (int i=0; i<n; i++) m[w[i]] = i;
for (int i=0; i<n; i++) l[i] = m[l[i]];
/*for (int x : l) cout << x << " ";
cout << "\n";*/
return l;
}
int find_next_station(int s, int t, vector<int> c){
if (c.size() == 1) return c[0];
if (s == 0){
vector<int> d(c.size());
for (int i=0; i<c.size(); i++){
if (i == 0) d[i] = s+1;
else d[i] = c[i-1]+1;
if (d[i] <= t && t <= c[i]) return c[i];
}
}
else {
int x = 2000;
for (int y : c) x = min(x, y);
if (s < x){
vector<int> d(c.size()-1);
for (int i=0; i<c.size()-1; i++){
if (i == 0) d[i] = s+1;
else d[i] = c[i-1]+1;
if (d[i] <= t && t <= c[i]) return c[i];
}
return c.back();
}
else {
vector<int> d(c.size());
for (int i=c.size()-1; i>=0; i--){
if (i == c.size()-1) d[i] = s-1;
else d[i] = c[i+1]-1;
if (c[i] <= t && t <= d[i]) return c[i];
}
return c[0];
}
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
