Submission #524518

# Submission time Handle Problem Language Result Execution time Memory
524518 2022-02-09T11:42:32 Z Turkhuu Stations (IOI20_stations) C++17
5 / 100
834 ms 748 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> label(int n, int k, vector<int> U, vector<int> V){
  vector<vector<int>> g(n);
  for(int i = 0; i < n - 1; i++){
    g[U[i]].push_back(V[i]);
    g[V[i]].push_back(U[i]);
  }
  vector<int> a(n);
  int x = 0;
  function<void(int, int)> dfs = [&](int u, int anc){
    a[u] = x++;
    for(int v : g[u]){
      if(v != anc){
        dfs(v, u);
      }
    }
  };
  for(int i = 0; ; i++){
    if((int)g[i].size() == 1){
      dfs(i, i);
      return a;
    }
  }
}

int find_next_station(int s, int t, vector<int> c){
  if(s > t){
    return c[0];
  } else{
    return c.back();
  }
}
# Verdict Execution time Memory Grader output
1 Correct 414 ms 532 KB Output is correct
2 Correct 389 ms 660 KB Output is correct
3 Correct 733 ms 492 KB Output is correct
4 Correct 661 ms 404 KB Output is correct
5 Correct 569 ms 400 KB Output is correct
6 Correct 358 ms 532 KB Output is correct
7 Correct 456 ms 608 KB Output is correct
8 Correct 1 ms 476 KB Output is correct
9 Correct 3 ms 476 KB Output is correct
10 Correct 1 ms 480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 377 ms 520 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 509 ms 620 KB Output is correct
2 Correct 393 ms 608 KB Output is correct
3 Correct 718 ms 400 KB Output is correct
4 Correct 541 ms 400 KB Output is correct
5 Correct 614 ms 528 KB Output is correct
6 Correct 391 ms 616 KB Output is correct
7 Correct 416 ms 616 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 1 ms 472 KB Output is correct
11 Incorrect 531 ms 488 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 734 ms 488 KB Output is correct
2 Correct 654 ms 400 KB Output is correct
3 Correct 558 ms 404 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 3 ms 476 KB Output is correct
6 Correct 1 ms 464 KB Output is correct
7 Incorrect 573 ms 400 KB Wrong query response.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 521 ms 528 KB Output is correct
2 Correct 395 ms 748 KB Output is correct
3 Correct 834 ms 400 KB Output is correct
4 Correct 692 ms 404 KB Output is correct
5 Correct 570 ms 404 KB Output is correct
6 Correct 464 ms 532 KB Output is correct
7 Correct 467 ms 532 KB Output is correct
8 Correct 2 ms 476 KB Output is correct
9 Correct 4 ms 508 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Incorrect 425 ms 476 KB Wrong query response.
12 Halted 0 ms 0 KB -