Submission #306768

# Submission time Handle Problem Language Result Execution time Memory
306768 2020-09-26T08:56:57 Z VEGAnn Stations (IOI20_stations) C++14
0 / 100
3 ms 640 KB
#include "stations.h"
#include <bits/stdc++.h>
#define PB push_back
#define sz(x) ((int)x.size())
using namespace std;
vector<int> g[1000];
int tin[1000], tout[1000], tt = 0;

void dfs(int v, int p){
    tin[v] = tt++;

    for (int u : g[v]){
        if (u == p) continue;
        dfs(u, v);
    }

    tout[v] = tt - 1;
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
//    for (int i = 0; i < sz(u); i++){
//        g[u[i]].PB(v[i]);
//        g[v[i]].PB(u[i]);
//    }

    dfs(0, -1);

    vector<int> labels;

    labels.resize(n);

    for (int i = 0; i < n; i++) {
        labels[i] = tin[i] * 1000 + tout[i];
        assert(labels[i] <= k);
    }

	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
//    int N = 1000;
//
//    int tin_s = s / N;
//    int tout_s = s % N;
//
//    int tin_t = t / N;
//    int tout_t = t % N;
//
//    if (tin_s <= tin_t && tout_s >= tout_t){
//        for (int v : c) {
//            int tin_v = v / N;
//            int tout_v = v % N;
//
//            if (tin_v > tin_s && tin_v <= tin_t && tout_v >= tout_t)
//                return v;
//        }
//    } else {
//        for (int v : c)
//            if (v / N < tin_s)
//                return v;
//    }
    return c[0];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 416 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 416 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -