Submission #424232

# Submission time Handle Problem Language Result Execution time Memory
424232 2021-06-11T18:25:42 Z OttoTheDino Stations (IOI20_stations) C++17
0 / 100
1097 ms 792 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,e)                          for (int i = s; i <= e; ++i)
#define pb                                  push_back
typedef vector<int> vi;

const int mxn = 2e3;
int id, res[mxn];
vi neibs[mxn];

void dfs (int u, int prev) {
    for (int v : neibs[u]) {
        if (v==prev) continue;
        dfs (v, u);
    }
    res[u]=id++;
}

vi label (int n, int k, vi u, vi v) {
    rep (i,0,n-2) {
        neibs[u[i]].pb(v[i]);
        neibs[v[i]].pb(u[i]);
    }
    dfs (0,-1);
    vi L(n);
    rep (i,0,n-1) L[i] = res[i];

    rep (i,0,n-1) neibs[i].clear();
    id = 0;

    return L;
}

int find_next_station (int s, int t, vi c) {
    sort(c.begin(), c.end());
    for (int v : c) if (v>=t) return v;
    return c.back();
}
# Verdict Execution time Memory Grader output
1 Incorrect 520 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 572 ms 656 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 563 ms 784 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1097 ms 656 KB Output is correct
2 Correct 728 ms 784 KB Output is correct
3 Incorrect 573 ms 792 KB Wrong query response.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 582 ms 664 KB Wrong query response.
2 Halted 0 ms 0 KB -