답안 #336000

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336000 2020-12-14T13:11:11 Z richyrich 기지국 (IOI20_stations) C++17
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4+3;
const int inf = 1e9;
int ans[N], timer;
vector<vector<int>> adj(N);
void dfs(int x, int par) {
    for(int y : adj[x]) {
        if(y==par) continue;
        dfs(y, x);
    }
    ans[x] = timer++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    timer = 0;
    for(int i = 0; i < n-1; i++) {
        adj[u[i]].push_back(v[i]), adj[v[i]].push_back(u[i]);
    }
    for(int i = 0; i < n; i++) {
        if(adj[i].size()==1) {
            dfs(i, -1);
            break;
        }
    }
    std::vector<int> labels(n);
    for(int i = 0; i < n; i++) labels[i] = ans[i];
    return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if(s > t) return c[0];
    else return c[c.size()-1];
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2065 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3049 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1700 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 951 ms 1120 KB Output is correct
2 Incorrect 753 ms 1248 KB Wrong query response.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2887 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -