답안 #416574

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
416574 2021-06-02T16:09:41 Z Dilshod_Imomov 기지국 (IOI20_stations) C++17
10 / 100
851 ms 55520 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;
		}
	}
	assert( pr != -1 );
	return pr;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 294 ms 55196 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 546 ms 896 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 826 ms 55444 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 851 ms 400 KB Output is correct
2 Correct 643 ms 488 KB Output is correct
3 Correct 591 ms 400 KB Output is correct
4 Correct 3 ms 464 KB Output is correct
5 Correct 4 ms 468 KB Output is correct
6 Correct 1 ms 476 KB Output is correct
7 Correct 576 ms 616 KB Output is correct
8 Correct 835 ms 400 KB Output is correct
9 Correct 661 ms 488 KB Output is correct
10 Correct 538 ms 488 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 4 ms 468 KB Output is correct
13 Correct 5 ms 468 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 503 ms 484 KB Output is correct
17 Correct 495 ms 488 KB Output is correct
18 Correct 498 ms 400 KB Output is correct
19 Correct 484 ms 484 KB Output is correct
20 Correct 489 ms 484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 848 ms 55520 KB Wrong query response.
2 Halted 0 ms 0 KB -