Submission #524513

# Submission time Handle Problem Language Result Execution time Memory
524513 2022-02-09T11:35:17 Z Turkhuu Stations (IOI20_stations) C++17
5 / 100
836 ms 752 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> label(int n, int k, vector<int> U, vector<int> V){
  vector<int> a(n);
	vector<vector<int>> g(n);
	for(int i = 0; i < n - 1; i++){
		g[U[i]].push_back(V[i]);
		g[V[i]].push_back(U[i]);
	}
	int x = 0;
	function<void(int, int)> dfs = [&](int u, int anc){
		a[u] = x++;
		for(int v : g[u]){
			if(v != anc){
				dfs(v, u);
			}
		}
	};
	for(int i = 0; ; i++){
		if((int)g[i].size() == 1){
			dfs(i, i);
			return a;
		}
	}
}

int find_next_station(int s, int t, vector<int> c){
	if(s > t){
		return *min_element(c.begin(), c.end());
	} else{
		return *max_element(c.begin(), c.end());
	}
}
# Verdict Execution time Memory Grader output
1 Correct 578 ms 528 KB Output is correct
2 Correct 460 ms 528 KB Output is correct
3 Correct 750 ms 400 KB Output is correct
4 Correct 596 ms 400 KB Output is correct
5 Correct 555 ms 400 KB Output is correct
6 Correct 419 ms 528 KB Output is correct
7 Correct 377 ms 612 KB Output is correct
8 Correct 3 ms 476 KB Output is correct
9 Correct 4 ms 476 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 382 ms 492 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 502 ms 532 KB Output is correct
2 Correct 356 ms 528 KB Output is correct
3 Correct 765 ms 488 KB Output is correct
4 Correct 622 ms 400 KB Output is correct
5 Correct 597 ms 656 KB Output is correct
6 Correct 460 ms 612 KB Output is correct
7 Correct 457 ms 532 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 5 ms 476 KB Output is correct
10 Correct 1 ms 476 KB Output is correct
11 Incorrect 589 ms 492 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 679 ms 400 KB Output is correct
2 Correct 649 ms 488 KB Output is correct
3 Correct 549 ms 404 KB Output is correct
4 Correct 2 ms 464 KB Output is correct
5 Correct 4 ms 476 KB Output is correct
6 Correct 0 ms 476 KB Output is correct
7 Incorrect 583 ms 400 KB Wrong query response.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 536 ms 608 KB Output is correct
2 Correct 433 ms 524 KB Output is correct
3 Correct 836 ms 400 KB Output is correct
4 Correct 600 ms 532 KB Output is correct
5 Correct 497 ms 532 KB Output is correct
6 Correct 441 ms 752 KB Output is correct
7 Correct 388 ms 608 KB Output is correct
8 Correct 2 ms 476 KB Output is correct
9 Correct 3 ms 472 KB Output is correct
10 Correct 1 ms 476 KB Output is correct
11 Incorrect 438 ms 528 KB Wrong query response.
12 Halted 0 ms 0 KB -