답안 #590733

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590733 2022-07-06T09:33:10 Z proma 기지국 (IOI20_stations) C++17
5 / 100
870 ms 652 KB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>

using namespace std;

vector <int> g[1005];

void dfs(int v, int p, int lab, vector <int> &labels) {
    labels[v] = lab ++;
    for (auto i: g[v]) {
        if (i != p) dfs(i, v, lab, labels);
    }
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels(n), deg(n);
    for (int i = 0; i <= n; i ++) {
        g[i].clear();
    }
    for (int i = 0; i < n - 1; i ++) {
        deg[u[i]] ++;
        deg[v[i]] ++;
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
    }
    for (int i = 0; i < n; i ++) {
        if (deg[i] == 1) {
            dfs(i, -1, 0, labels);
            break;
        }
    }/*
    for (auto i: labels) {
        cout << i << " ";
    } cout << endl;*/
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	if (c.size() == 1) return c[0];
	if (s < t and s) return c[1];
	return c[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 501 ms 544 KB Output is correct
2 Correct 392 ms 636 KB Output is correct
3 Correct 766 ms 416 KB Output is correct
4 Correct 608 ms 416 KB Output is correct
5 Correct 456 ms 504 KB Output is correct
6 Correct 390 ms 528 KB Output is correct
7 Correct 453 ms 528 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 3 ms 492 KB Output is correct
10 Correct 0 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 320 KB Invalid labels (duplicates values). scenario=0, label=10
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 534 ms 596 KB Output is correct
2 Correct 434 ms 652 KB Output is correct
3 Correct 860 ms 416 KB Output is correct
4 Correct 595 ms 524 KB Output is correct
5 Correct 506 ms 528 KB Output is correct
6 Correct 396 ms 544 KB Output is correct
7 Correct 478 ms 524 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 4 ms 500 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Incorrect 0 ms 208 KB Invalid labels (duplicates values). scenario=1, label=2
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 870 ms 524 KB Output is correct
2 Correct 637 ms 416 KB Output is correct
3 Correct 484 ms 420 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 3 ms 492 KB Output is correct
6 Correct 0 ms 492 KB Output is correct
7 Incorrect 1 ms 320 KB Invalid labels (duplicates values). scenario=0, label=2
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 504 ms 532 KB Output is correct
2 Correct 424 ms 548 KB Output is correct
3 Correct 837 ms 536 KB Output is correct
4 Correct 617 ms 528 KB Output is correct
5 Correct 558 ms 568 KB Output is correct
6 Correct 420 ms 532 KB Output is correct
7 Correct 455 ms 528 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 4 ms 492 KB Output is correct
10 Correct 1 ms 488 KB Output is correct
11 Incorrect 3 ms 316 KB Invalid labels (duplicates values). scenario=0, label=10
12 Halted 0 ms 0 KB -