Submission #321676

# Submission time Handle Problem Language Result Execution time Memory
321676 2020-11-13T03:13:58 Z Gilgamesh Stations (IOI20_stations) C++17
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

const int mxN = 1'001;

vector<int> adj[mxN];
int timer;
int temp[mxN];

void dfs(int v, int p){
	temp[timer++] = v;
	for(int i : adj[v]) {
		if(i == p) continue;
		dfs(i, 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){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	timer = 0;
	dfs(0, -1);
	for(int i = 0; i < n; ++i){
		labels[i] = temp[i];
	}
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	sort(c.begin(), c.end());
	if(t < s) {
		return c[0];
	} else {
		int ans = 0;
		for(int i : c){
			if(t < i) break;
			ans = i;
		}
		return ans;
	}
}

//int main(){}
# Verdict Execution time Memory Grader output
1 Runtime error 1521 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 3046 ms 492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1607 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 879 ms 864 KB Output is correct
2 Runtime error 1246 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 2745 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -