Submission #307118

# Submission time Handle Problem Language Result Execution time Memory
307118 2020-09-27T06:46:16 Z dxz05 Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1111;

vector<int> g[MAXN];
vector<int> vec;
void dfs(int v, int p){
    vec.push_back(v);
    for (int u : g[v]){
        if (u != p) dfs(u, v);
    }
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels(n);
	for (int i = 0; i < n - 1; i++){
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
	}

	int idx = 0;
	for (int i = 0; i < n; i++){
        if (g[i].size() == 1) idx = i;
	}

	dfs(idx, -1);
	for (int i = 0; i < n; i++){
        labels[vec[i]] = i;
	}
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	return (s < t ? s + 1 : s - 1);
}
# Verdict Execution time Memory Grader output
1 Runtime error 1737 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3107 ms 1051260 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1884 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 865 ms 768 KB Output is correct
2 Runtime error 1571 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3004 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -