Submission #318645

# Submission time Handle Problem Language Result Execution time Memory
318645 2020-11-02T16:19:40 Z tengiz05 Stations (IOI20_stations) C++17
0 / 100
1027 ms 1212 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> edges[1005];
int a[1005];
vector<bool> used;
int timer=0;
void dfs(int u){
	a[u] = timer;timer++;
	used[u] = true;
	for(auto v:edges[u]){
		if(used[v])continue;
		dfs(v);
	}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	for(int i=0;i<n;i++)edges[i].clear();
	for(int i=0;i<n-1;i++){
		edges[u[i]].push_back(v[i]);
		edges[v[i]].push_back(u[i]);
	}
	timer=0;
	used.assign(n,0);
	dfs(0);
	vector<int> ans(n);
	for(int i=0;i<n;i++)ans[i] = a[i];
	return ans;
}
/*

1
5 10
0 1
1 2
2 3
3 4
3
1 3 121
1 4 121
0 1 122

*/

int find_next_station(int s, int t, vector<int> c) {
	sort(c.begin(), c.end());
//	cout << s << ": " << t << '\n';
	if(t < s){
		return c[0];
	}else {
		int ans = c[0];
		for(auto x : c){
			if(x <= t)ans = max(ans, x);
		//	cout << x << ' ';
		}//cout << '\n';
		return ans;
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 542 ms 1116 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 468 ms 736 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 551 ms 1036 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1027 ms 940 KB Output is correct
2 Correct 685 ms 864 KB Output is correct
3 Incorrect 601 ms 864 KB Wrong query response.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 561 ms 1212 KB Wrong query response.
2 Halted 0 ms 0 KB -