답안 #308626

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
308626 2020-10-01T15:19:05 Z szekelymilan 기지국 (IOI20_stations) C++14
31.0422 / 100
1020 ms 1272 KB
#include "stations.h"
#include <vector>

const int P = 2000;

std::vector<std::vector<int>> G;
std::vector<int> labels;
int timeCounter;

void DFS(int node = 0) {
  labels[node] = (timeCounter++) * P;

  for (int v : G[node])
    if (labels[v] == -1)
      DFS(v);
  
  labels[node] += timeCounter++;
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
  G.assign(n, std::vector<int>());
  labels.assign(n, -1);
  timeCounter = 0;

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

  DFS();

  return labels;
}

inline bool inside(int a, int b) {
  return a / P <= b / P && b % P <= a % P;
}

int find_next_station(int s, int t, std::vector<int> c) {
  int parent = -1;

  for (int node : c)
    if (inside(node, s))
      parent = node;
  
  for (int node : c)
    if (node != parent && inside(node, t))
      return node;
  
  return parent;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 384 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=14014
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1991
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 384 KB Invalid labels (values out of range). scenario=1, k=1000000, vertex=3, label=1157149
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1003 ms 660 KB Output is correct
2 Correct 703 ms 660 KB Output is correct
3 Correct 636 ms 652 KB Output is correct
4 Correct 2 ms 660 KB Output is correct
5 Correct 9 ms 640 KB Output is correct
6 Correct 1 ms 664 KB Output is correct
7 Correct 685 ms 640 KB Output is correct
8 Correct 976 ms 656 KB Output is correct
9 Correct 780 ms 656 KB Output is correct
10 Correct 686 ms 832 KB Output is correct
11 Correct 7 ms 656 KB Output is correct
12 Correct 6 ms 640 KB Output is correct
13 Correct 5 ms 664 KB Output is correct
14 Correct 5 ms 640 KB Output is correct
15 Correct 2 ms 668 KB Output is correct
16 Correct 577 ms 660 KB Output is correct
17 Correct 511 ms 656 KB Output is correct
18 Correct 552 ms 660 KB Output is correct
19 Correct 669 ms 660 KB Output is correct
20 Correct 540 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 601 ms 1024 KB Partially correct
2 Partially correct 506 ms 760 KB Partially correct
3 Partially correct 991 ms 640 KB Partially correct
4 Partially correct 718 ms 664 KB Partially correct
5 Partially correct 633 ms 660 KB Partially correct
6 Partially correct 500 ms 804 KB Partially correct
7 Partially correct 486 ms 820 KB Partially correct
8 Partially correct 2 ms 656 KB Partially correct
9 Partially correct 3 ms 640 KB Partially correct
10 Partially correct 1 ms 660 KB Partially correct
11 Partially correct 491 ms 768 KB Partially correct
12 Partially correct 567 ms 768 KB Partially correct
13 Partially correct 1020 ms 640 KB Partially correct
14 Partially correct 718 ms 888 KB Partially correct
15 Partially correct 803 ms 640 KB Partially correct
16 Partially correct 630 ms 836 KB Partially correct
17 Partially correct 754 ms 768 KB Partially correct
18 Partially correct 618 ms 840 KB Partially correct
19 Partially correct 586 ms 1224 KB Partially correct
20 Partially correct 597 ms 768 KB Partially correct
21 Partially correct 73 ms 640 KB Partially correct
22 Partially correct 71 ms 868 KB Partially correct
23 Partially correct 119 ms 904 KB Partially correct
24 Partially correct 6 ms 640 KB Partially correct
25 Partially correct 7 ms 664 KB Partially correct
26 Partially correct 7 ms 640 KB Partially correct
27 Partially correct 4 ms 640 KB Partially correct
28 Partially correct 1 ms 640 KB Partially correct
29 Partially correct 568 ms 656 KB Partially correct
30 Partially correct 650 ms 640 KB Partially correct
31 Partially correct 639 ms 748 KB Partially correct
32 Partially correct 687 ms 736 KB Partially correct
33 Partially correct 529 ms 768 KB Partially correct
34 Partially correct 444 ms 1008 KB Partially correct
35 Partially correct 484 ms 792 KB Partially correct
36 Partially correct 590 ms 1272 KB Partially correct
37 Partially correct 500 ms 988 KB Partially correct
38 Partially correct 538 ms 888 KB Partially correct
39 Partially correct 517 ms 760 KB Partially correct
40 Partially correct 619 ms 764 KB Partially correct
41 Partially correct 522 ms 804 KB Partially correct
42 Partially correct 91 ms 768 KB Partially correct
43 Partially correct 132 ms 768 KB Partially correct
44 Partially correct 167 ms 768 KB Partially correct
45 Partially correct 209 ms 768 KB Partially correct
46 Partially correct 353 ms 848 KB Partially correct
47 Partially correct 401 ms 760 KB Partially correct
48 Partially correct 63 ms 1180 KB Partially correct
49 Partially correct 78 ms 768 KB Partially correct