답안 #306775

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
306775 2020-09-26T09:06:59 Z VEGAnn 기지국 (IOI20_stations) C++14
5 / 100
3000 ms 1044 KB
#include "stations.h"
#include <bits/stdc++.h>
#define PB push_back
#define sz(x) ((int)x.size())
using namespace std;
vector<int> g[1000];
int tin[1000], tout[1000], tt = 0;

void dfs(int v, int p){
    tin[v] = tt++;

    for (int u : g[v]){
        if (u == p) continue;
        dfs(u, v);
    }

    tout[v] = tt - 1;
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    for (int i = 0; i < n; i++)
        g[i].clear();

    tt = 0;

    for (int i = 0; i < sz(u); i++){
        g[u[i]].PB(v[i]);
        g[v[i]].PB(u[i]);
    }

    int root = 0;

    while (sz(g[root]) > 1) root++;

    dfs(root, -1);

    vector<int> labels;

    labels.resize(n);

    for (int i = 0; i < n; i++) {
        labels[i] = tin[i];
    }

	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    for (int v : c)
        if (abs(v - t) < abs(s - t))
            return v;
    while (1) {}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 520 ms 1008 KB Output is correct
2 Correct 495 ms 776 KB Output is correct
3 Correct 859 ms 872 KB Output is correct
4 Correct 623 ms 768 KB Output is correct
5 Correct 586 ms 872 KB Output is correct
6 Correct 451 ms 776 KB Output is correct
7 Correct 456 ms 1040 KB Output is correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 4 ms 768 KB Output is correct
10 Correct 2 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3036 ms 816 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 532 ms 1020 KB Output is correct
2 Correct 444 ms 768 KB Output is correct
3 Correct 866 ms 876 KB Output is correct
4 Correct 690 ms 768 KB Output is correct
5 Correct 593 ms 872 KB Output is correct
6 Correct 465 ms 772 KB Output is correct
7 Correct 470 ms 792 KB Output is correct
8 Correct 3 ms 876 KB Output is correct
9 Correct 4 ms 884 KB Output is correct
10 Correct 1 ms 868 KB Output is correct
11 Execution timed out 3034 ms 1024 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 975 ms 768 KB Output is correct
2 Correct 671 ms 1004 KB Output is correct
3 Correct 601 ms 1044 KB Output is correct
4 Correct 2 ms 768 KB Output is correct
5 Correct 5 ms 768 KB Output is correct
6 Correct 2 ms 880 KB Output is correct
7 Execution timed out 3041 ms 876 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 516 ms 772 KB Output is correct
2 Correct 568 ms 772 KB Output is correct
3 Correct 1022 ms 872 KB Output is correct
4 Correct 706 ms 868 KB Output is correct
5 Correct 564 ms 1032 KB Output is correct
6 Correct 430 ms 784 KB Output is correct
7 Correct 429 ms 780 KB Output is correct
8 Correct 3 ms 876 KB Output is correct
9 Correct 4 ms 768 KB Output is correct
10 Correct 2 ms 872 KB Output is correct
11 Execution timed out 3037 ms 768 KB Time limit exceeded
12 Halted 0 ms 0 KB -