Submission #768091

# Submission time Handle Problem Language Result Execution time Memory
768091 2023-06-27T12:46:37 Z Nicolaikrob Stations (IOI20_stations) C++17
5 / 100
799 ms 640 KB
#include <bits/stdc++.h>
using namespace std;

vector<vector<int>> G;
vector<bool> V;
vector<int> L;

int dfs(int v, int d) {
    V[v] = 0; L[v] = d;
    for(auto x : G[v])
        if(V[x]) return dfs(x, d+1);
    return v;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    G.clear(); V.clear(); L.clear();
    G.resize(n); V.resize(n, 1); L.resize(n);
    for(int i = 0; i < n-1; i++) {
        G[u[i]].push_back(v[i]);
        G[v[i]].push_back(u[i]);
    }
    int ep = dfs(0, 0);
    V.assign(n, 1);
    dfs(ep, 0);
    return L;
}

int find_next_station(int s, int t, vector<int> c) {
    if(size(c) == 1) return c[0];
    else if(t > s) return max(c[0], c[1]);
    else return min(c[0], c[1]);
}
# Verdict Execution time Memory Grader output
1 Correct 446 ms 548 KB Output is correct
2 Correct 324 ms 628 KB Output is correct
3 Correct 799 ms 416 KB Output is correct
4 Correct 567 ms 416 KB Output is correct
5 Correct 436 ms 416 KB Output is correct
6 Correct 314 ms 508 KB Output is correct
7 Correct 324 ms 548 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 4 ms 472 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 336 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 407 ms 596 KB Output is correct
2 Correct 396 ms 548 KB Output is correct
3 Correct 780 ms 488 KB Output is correct
4 Correct 409 ms 508 KB Output is correct
5 Correct 545 ms 504 KB Output is correct
6 Correct 414 ms 544 KB Output is correct
7 Correct 401 ms 544 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 2 ms 496 KB Output is correct
10 Correct 0 ms 492 KB Output is correct
11 Incorrect 1 ms 296 KB Invalid labels (duplicates values). scenario=1, label=0
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 629 ms 416 KB Output is correct
2 Correct 566 ms 512 KB Output is correct
3 Correct 505 ms 420 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 4 ms 492 KB Output is correct
6 Correct 2 ms 500 KB Output is correct
7 Incorrect 1 ms 296 KB Invalid labels (duplicates values). scenario=0, label=0
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 398 ms 640 KB Output is correct
2 Correct 389 ms 584 KB Output is correct
3 Correct 779 ms 544 KB Output is correct
4 Correct 585 ms 500 KB Output is correct
5 Correct 532 ms 420 KB Output is correct
6 Correct 309 ms 548 KB Output is correct
7 Correct 415 ms 504 KB Output is correct
8 Correct 2 ms 500 KB Output is correct
9 Correct 3 ms 492 KB Output is correct
10 Correct 0 ms 492 KB Output is correct
11 Incorrect 4 ms 424 KB Invalid labels (duplicates values). scenario=0, label=0
12 Halted 0 ms 0 KB -