# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
697064 | garam1732 | 기지국 (IOI20_stations) | C++14 | 946 ms | 916 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
vector<int> adj[1010];
int in[1010], out[1010], cnt;
void dfs(int here, int par, bool flag, vector<int>& labels) {
in[here] = cnt++;
for(int there : adj[here]) {
if(there == par) continue;
dfs(there, here, !flag, labels);
}
out[here] = cnt++;
labels[here] = (flag ? in[here] : out[here]);
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
for(int i = 0; i < n; i++) adj[i].clear();
cnt = 0;
for(int i = 0; i < u.size(); i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
dfs(0, 0, 0, labels);
priority_queue<pi> pq;
for(int i = 0; i < n; i++) pq.push(pi(labels[i], i));
for(int i = n-1; i >= 0; i--) {
labels[pq.top().second] = i;
pq.pop();
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if(s < c[0]) {
if(s < t && t <= c[0]) return c[0];
for(int i = 1; i < c.size(); i++) if(c[i-1] < t && t <= c[i]) return c[i];
return *c.rbegin();
}
for(int i = 2; i < c.size(); i++) if(c[i-1] <= t && t < c[i]) return c[i-1];
if(*c.rbegin() <= t && t < s) return *c.rbegin();
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... |