# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
431365 | idk321 | Stations (IOI20_stations) | C++17 | 1226 ms | 700 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include <vector>
using namespace std;
const int M = 1000000000;
const int N = 1000;
int in[N];
int out[N];
vector<int> adj[N];
vector<int> labels;
int n, k;
int timer;
void dfs2(int node, int par)
{
timer++;
in[node] = timer;
for (int next : adj[node])
{
if (next == par) continue;
dfs2(next, node);
}
out[node] = timer;
}
std::vector<int> label(int n1, int k1, std::vector<int> u, std::vector<int> v) {
n = n1;
k = k1;
labels.assign(n, 0);
for (int i = 0; i < n; i++) adj[i].clear();
for (int i = 0; i < u.size(); i++)
{
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
timer = -1;
dfs2(0, -1);
for (int i = 0; i < n; i++) {
labels[i] = in[i] * 1000 + out[i];
}
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
int sIn = s / 1000;
int sOut = s % 1000;
int tIn = t / 1000;
int tOut = t % 1000;
if (sIn <= tIn && tOut <= sOut)
{
for (int next : c)
{
int nextIn = next / 1000;
int nextOut = next % 1000;
if (!(nextIn <= sIn && sOut <= nextOut) && (nextIn <= tIn && tOut <= nextOut)) return next;
}
} else
{
for (int next : c)
{
int nextIn = next / 1000;
int nextOut = next % 1000;
if (nextIn <= sIn && sOut <= nextOut) return next;
}
}
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... |