답안 #828816

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
828816 2023-08-17T16:35:33 Z Minindu206 기지국 (IOI20_stations) C++14
69.868 / 100
793 ms 816 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> vals;
int t = 0;
void dfs(vector<vector<int>> &adj, int node, int p, int f)
{
	if(f)vals[node] = t++;
	for (auto a : adj[node])
	{
		if (a != p)
			dfs(adj, a, node, !f);
	}
	if(!f)vals[node] = t++;
}
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++)
	{
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	vals.resize(n, 0);
	dfs(adj, 0, -1, 1);

	// for (int i = 0; i < n; i++)
	// 	cout << vals[i] << "\n";
	// cout << '\n';
	return vals;
}

int find_next_station(int s, int t, vector<int> c)
{
	
	if (c.back() < s) reverse(c.begin(), c.end());
	for (int x: c) if (min(s, x) <= t && t <= max(s, x)) return x;
	return c.back();
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 424 KB Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1008
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 292 KB Invalid labels (values out of range). scenario=1, k=1000, vertex=1, label=1507
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 489 ms 632 KB Output is correct
2 Correct 347 ms 664 KB Output is correct
3 Correct 793 ms 416 KB Output is correct
4 Correct 453 ms 508 KB Output is correct
5 Correct 438 ms 512 KB Output is correct
6 Correct 299 ms 672 KB Output is correct
7 Correct 378 ms 636 KB Output is correct
8 Correct 1 ms 500 KB Output is correct
9 Correct 3 ms 496 KB Output is correct
10 Correct 0 ms 492 KB Output is correct
11 Correct 500 ms 416 KB Output is correct
12 Correct 374 ms 668 KB Output is correct
13 Correct 460 ms 708 KB Output is correct
14 Correct 389 ms 508 KB Output is correct
15 Correct 41 ms 492 KB Output is correct
16 Correct 41 ms 572 KB Output is correct
17 Correct 94 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 681 ms 504 KB Output is correct
2 Correct 593 ms 508 KB Output is correct
3 Correct 532 ms 420 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 1 ms 548 KB Output is correct
7 Correct 370 ms 496 KB Output is correct
8 Correct 691 ms 504 KB Output is correct
9 Correct 567 ms 416 KB Output is correct
10 Correct 552 ms 420 KB Output is correct
11 Correct 3 ms 492 KB Output is correct
12 Correct 6 ms 476 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 2 ms 500 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Correct 482 ms 504 KB Output is correct
17 Correct 459 ms 504 KB Output is correct
18 Correct 385 ms 416 KB Output is correct
19 Correct 373 ms 508 KB Output is correct
20 Correct 391 ms 420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 341 ms 672 KB Partially correct
2 Partially correct 386 ms 672 KB Partially correct
3 Correct 611 ms 592 KB Output is correct
4 Correct 450 ms 508 KB Output is correct
5 Correct 517 ms 420 KB Output is correct
6 Partially correct 275 ms 544 KB Partially correct
7 Correct 386 ms 544 KB Output is correct
8 Correct 1 ms 500 KB Output is correct
9 Correct 2 ms 500 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Partially correct 399 ms 508 KB Partially correct
12 Partially correct 412 ms 544 KB Partially correct
13 Correct 627 ms 512 KB Output is correct
14 Correct 513 ms 500 KB Output is correct
15 Correct 424 ms 512 KB Output is correct
16 Correct 428 ms 508 KB Output is correct
17 Correct 469 ms 420 KB Output is correct
18 Partially correct 380 ms 640 KB Partially correct
19 Partially correct 349 ms 748 KB Partially correct
20 Correct 356 ms 508 KB Output is correct
21 Correct 47 ms 444 KB Output is correct
22 Partially correct 57 ms 572 KB Partially correct
23 Partially correct 79 ms 544 KB Partially correct
24 Correct 5 ms 496 KB Output is correct
25 Correct 3 ms 492 KB Output is correct
26 Correct 4 ms 500 KB Output is correct
27 Correct 2 ms 496 KB Output is correct
28 Correct 0 ms 492 KB Output is correct
29 Correct 484 ms 416 KB Output is correct
30 Correct 423 ms 508 KB Output is correct
31 Correct 368 ms 508 KB Output is correct
32 Correct 414 ms 416 KB Output is correct
33 Correct 355 ms 420 KB Output is correct
34 Partially correct 245 ms 632 KB Partially correct
35 Partially correct 323 ms 628 KB Partially correct
36 Partially correct 366 ms 660 KB Partially correct
37 Partially correct 349 ms 620 KB Partially correct
38 Partially correct 350 ms 644 KB Partially correct
39 Partially correct 354 ms 720 KB Partially correct
40 Partially correct 341 ms 628 KB Partially correct
41 Partially correct 360 ms 816 KB Partially correct
42 Partially correct 54 ms 632 KB Partially correct
43 Partially correct 108 ms 544 KB Partially correct
44 Partially correct 116 ms 504 KB Partially correct
45 Partially correct 151 ms 596 KB Partially correct
46 Partially correct 218 ms 544 KB Partially correct
47 Partially correct 226 ms 508 KB Partially correct
48 Partially correct 56 ms 668 KB Partially correct
49 Partially correct 39 ms 660 KB Partially correct