답안 #422038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
422038 2021-06-09T15:38:59 Z Monchito 기지국 (IOI20_stations) C++14
0 / 100
1107 ms 828 KB
#include "stations.h"
#include <vector>
#include <iostream>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

int find_leaf(int current_node, int current_node_father, vvi& G){
    vector<int> adjacents;
    for(int v : G[current_node]){
        if(v == current_node_father) continue;
        adjacents.push_back(v);
    }

    if(adjacents.empty()) return current_node;
    return find_leaf(adjacents[0], current_node, G);
}

void find_order(int& current_id, int current_node, int current_node_father, vvi& G, vi& labels){
    labels[current_node] = current_id;
    current_id++;

    for(int v : G[current_node]){
        if(v == current_node_father) continue;
        labels[v] = current_id;
        current_id++;
        find_order(current_id, v, current_node, G, labels);
    }
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    vi labels(n);
    vvi G(n);
    int id=0, root = 0;

    for(int i=0; i<n-1; i++){
        G[u[i]].push_back(v[i]);
        G[v[i]].push_back(u[i]);
    }

    find_order(id, find_leaf(root, -1, G), -1, G, labels);
    return labels;
}

int find_next_station(int s, int t, vector<int> c) {
    if((int)c.size() == 1) return c[0];
    if(s > t) return c[0];
    return c[1];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 456 KB Invalid labels (values out of range). scenario=2, k=1000, vertex=4, label=1016
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 328 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=8, label=1498
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 631 ms 728 KB Output is correct
2 Correct 580 ms 616 KB Output is correct
3 Correct 1031 ms 400 KB Output is correct
4 Correct 821 ms 400 KB Output is correct
5 Correct 748 ms 480 KB Output is correct
6 Correct 540 ms 608 KB Output is correct
7 Correct 489 ms 604 KB Output is correct
8 Correct 3 ms 472 KB Output is correct
9 Correct 6 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Incorrect 714 ms 468 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1107 ms 464 KB Output is correct
2 Correct 791 ms 484 KB Output is correct
3 Correct 610 ms 400 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Incorrect 767 ms 432 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 586 ms 828 KB Partially correct
2 Partially correct 561 ms 616 KB Partially correct
3 Correct 989 ms 528 KB Output is correct
4 Correct 671 ms 400 KB Output is correct
5 Correct 660 ms 556 KB Output is correct
6 Partially correct 490 ms 720 KB Partially correct
7 Partially correct 531 ms 656 KB Partially correct
8 Correct 3 ms 480 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Incorrect 566 ms 572 KB Wrong query response.
12 Halted 0 ms 0 KB -