Submission #416572

# Submission time Handle Problem Language Result Execution time Memory
416572 2021-06-02T16:07:17 Z Dilshod_Imomov Stations (IOI20_stations) C++17
10 / 100
852 ms 55684 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 1e3 + 7;
 
void dfs( vector<vector<int>> adj, int v, int p, vector<int> &lb, int &cnt ) {
	lb[v] = cnt++;
	for ( auto u: adj[v] ) {
		if ( u != p ) {
			dfs( adj, u, v, lb, cnt );
		}
	}
	lb[v] *= 1000;
	lb[v] += cnt;
}
 
 
vector<int> label(int n, int k, vector<int> U, vector<int> V) {
	vector < vector < int > > adj(n + 1);
	for ( int i = 0; i < n - 1; i++ ) {
		int u = U[i], v = V[i];
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	vector < int > lb(n);
	int cnt = 0;
	dfs( adj, 0, -1, lb, cnt );
	return lb;
}
 
int find_next_station(int s, int t, vector<int> c) {
	int tins = s / 1000, touts = s % 1000;
	int tint = t / 1000, toutt = t % 1000;
	int pr = -1;
	for ( auto u: c ) {
		int tinu = u / 1000, toutu = u % 1000;
		if ( tinu <= tins && toutu >= touts ) {
			pr = u;
			continue;
		}
		if ( tinu <= tint && toutu >= toutt ) {
			return u;
		}
	}
	return pr;
}
# Verdict Execution time Memory Grader output
1 Incorrect 291 ms 55240 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6010
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 535 ms 808 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1512
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 824 ms 55392 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 829 ms 400 KB Output is correct
2 Correct 639 ms 468 KB Output is correct
3 Correct 559 ms 400 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 4 ms 468 KB Output is correct
6 Correct 1 ms 476 KB Output is correct
7 Correct 601 ms 400 KB Output is correct
8 Correct 816 ms 400 KB Output is correct
9 Correct 577 ms 400 KB Output is correct
10 Correct 599 ms 472 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 5 ms 468 KB Output is correct
13 Correct 6 ms 468 KB Output is correct
14 Correct 3 ms 468 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 483 ms 400 KB Output is correct
17 Correct 490 ms 532 KB Output is correct
18 Correct 465 ms 488 KB Output is correct
19 Correct 507 ms 528 KB Output is correct
20 Correct 503 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 852 ms 55684 KB Wrong query response.
2 Halted 0 ms 0 KB -