답안 #416580

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
416580 2021-06-02T16:20:39 Z Dilshod_Imomov 기지국 (IOI20_stations) C++17
10 / 100
867 ms 55552 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;
	if ( cnt == 1000000 ) {
		cnt--;
	}
	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;
		}
	}
	assert( pr != -1 );
	return pr;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 291 ms 55280 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6010
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 537 ms 820 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1512
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 802 ms 55444 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 867 ms 400 KB Output is correct
2 Correct 620 ms 400 KB Output is correct
3 Correct 588 ms 484 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 4 ms 468 KB Output is correct
6 Correct 1 ms 476 KB Output is correct
7 Correct 531 ms 488 KB Output is correct
8 Correct 843 ms 528 KB Output is correct
9 Correct 653 ms 528 KB Output is correct
10 Correct 579 ms 472 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 6 ms 504 KB Output is correct
13 Correct 5 ms 468 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 492 ms 484 KB Output is correct
17 Correct 493 ms 400 KB Output is correct
18 Correct 493 ms 400 KB Output is correct
19 Correct 487 ms 400 KB Output is correct
20 Correct 515 ms 400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 804 ms 55552 KB Wrong query response.
2 Halted 0 ms 0 KB -