답안 #318654

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
318654 2020-11-02T19:02:50 Z tengiz05 기지국 (IOI20_stations) C++17
100 / 100
1216 ms 1308 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> edges[1005];
int a[1005];
vector<bool> used;
int timer=0;
void dfs(int u, int d){
	if(d==0)a[u] = timer,timer++;
	used[u] = true;
	for(auto v:edges[u]){
		if(used[v])continue;
		dfs(v,d^1);
	}if(d==1)a[u] = timer,timer++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	for(int i=0;i<n;i++)edges[i].clear();
	for(int i=0;i<n-1;i++){
		edges[u[i]].push_back(v[i]);
		edges[v[i]].push_back(u[i]);
	}
	timer=0;
	used.assign(n,0);
	dfs(0,0);
	vector<int> ans(n);
	for(int i=0;i<n;i++)ans[i] = a[i];
	return ans;
}
/*

1
5 10
0 1
1 2
2 3
3 4
3
1 3 121
1 4 121
0 1 122

*/

int find_next_station(int s, int t, vector<int> c) {
//	cout << s << ": " << t << '\n';
	if(c[c.size()-1] < s){
		int ans = c[0];
		for(auto x : c){
			if(min(s, x) <= t && t <= max(s, x))ans = x;
		}return ans;
	}else {
		for(auto x : c)if(min(s, x) <= t && t <= max(s, x))return x;
		return c[c.size()-1];
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 544 ms 1096 KB Output is correct
2 Correct 521 ms 1100 KB Output is correct
3 Correct 1216 ms 1228 KB Output is correct
4 Correct 735 ms 864 KB Output is correct
5 Correct 597 ms 992 KB Output is correct
6 Correct 456 ms 1120 KB Output is correct
7 Correct 464 ms 824 KB Output is correct
8 Correct 3 ms 944 KB Output is correct
9 Correct 5 ms 956 KB Output is correct
10 Correct 2 ms 948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 545 ms 736 KB Output is correct
2 Correct 661 ms 1120 KB Output is correct
3 Correct 1081 ms 948 KB Output is correct
4 Correct 645 ms 948 KB Output is correct
5 Correct 739 ms 736 KB Output is correct
6 Correct 498 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 516 ms 876 KB Output is correct
2 Correct 562 ms 864 KB Output is correct
3 Correct 911 ms 944 KB Output is correct
4 Correct 821 ms 956 KB Output is correct
5 Correct 699 ms 944 KB Output is correct
6 Correct 507 ms 1096 KB Output is correct
7 Correct 522 ms 864 KB Output is correct
8 Correct 3 ms 944 KB Output is correct
9 Correct 5 ms 736 KB Output is correct
10 Correct 1 ms 948 KB Output is correct
11 Correct 684 ms 736 KB Output is correct
12 Correct 492 ms 1096 KB Output is correct
13 Correct 468 ms 864 KB Output is correct
14 Correct 506 ms 888 KB Output is correct
15 Correct 67 ms 932 KB Output is correct
16 Correct 69 ms 904 KB Output is correct
17 Correct 149 ms 888 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1007 ms 736 KB Output is correct
2 Correct 941 ms 736 KB Output is correct
3 Correct 715 ms 736 KB Output is correct
4 Correct 3 ms 864 KB Output is correct
5 Correct 4 ms 864 KB Output is correct
6 Correct 2 ms 736 KB Output is correct
7 Correct 785 ms 864 KB Output is correct
8 Correct 1022 ms 1100 KB Output is correct
9 Correct 716 ms 736 KB Output is correct
10 Correct 660 ms 948 KB Output is correct
11 Correct 6 ms 956 KB Output is correct
12 Correct 5 ms 948 KB Output is correct
13 Correct 4 ms 952 KB Output is correct
14 Correct 4 ms 864 KB Output is correct
15 Correct 2 ms 948 KB Output is correct
16 Correct 522 ms 736 KB Output is correct
17 Correct 547 ms 864 KB Output is correct
18 Correct 574 ms 944 KB Output is correct
19 Correct 484 ms 948 KB Output is correct
20 Correct 524 ms 864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 540 ms 1104 KB Output is correct
2 Correct 494 ms 1104 KB Output is correct
3 Correct 995 ms 948 KB Output is correct
4 Correct 676 ms 736 KB Output is correct
5 Correct 686 ms 1088 KB Output is correct
6 Correct 554 ms 1100 KB Output is correct
7 Correct 597 ms 864 KB Output is correct
8 Correct 3 ms 956 KB Output is correct
9 Correct 6 ms 952 KB Output is correct
10 Correct 1 ms 864 KB Output is correct
11 Correct 505 ms 888 KB Output is correct
12 Correct 759 ms 888 KB Output is correct
13 Correct 1010 ms 864 KB Output is correct
14 Correct 703 ms 864 KB Output is correct
15 Correct 763 ms 864 KB Output is correct
16 Correct 494 ms 884 KB Output is correct
17 Correct 742 ms 948 KB Output is correct
18 Correct 565 ms 864 KB Output is correct
19 Correct 562 ms 1108 KB Output is correct
20 Correct 529 ms 900 KB Output is correct
21 Correct 55 ms 940 KB Output is correct
22 Correct 79 ms 940 KB Output is correct
23 Correct 123 ms 884 KB Output is correct
24 Correct 7 ms 864 KB Output is correct
25 Correct 7 ms 736 KB Output is correct
26 Correct 6 ms 988 KB Output is correct
27 Correct 4 ms 992 KB Output is correct
28 Correct 2 ms 864 KB Output is correct
29 Correct 663 ms 952 KB Output is correct
30 Correct 577 ms 948 KB Output is correct
31 Correct 611 ms 952 KB Output is correct
32 Correct 566 ms 940 KB Output is correct
33 Correct 522 ms 952 KB Output is correct
34 Correct 409 ms 1124 KB Output is correct
35 Correct 502 ms 1084 KB Output is correct
36 Correct 541 ms 1112 KB Output is correct
37 Correct 519 ms 1116 KB Output is correct
38 Correct 518 ms 1112 KB Output is correct
39 Correct 536 ms 1220 KB Output is correct
40 Correct 583 ms 1120 KB Output is correct
41 Correct 568 ms 1132 KB Output is correct
42 Correct 81 ms 900 KB Output is correct
43 Correct 136 ms 896 KB Output is correct
44 Correct 171 ms 1124 KB Output is correct
45 Correct 152 ms 864 KB Output is correct
46 Correct 384 ms 896 KB Output is correct
47 Correct 336 ms 864 KB Output is correct
48 Correct 63 ms 1308 KB Output is correct
49 Correct 63 ms 992 KB Output is correct