답안 #336977

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336977 2020-12-17T14:45:51 Z Register 기지국 (IOI20_stations) C++14
100 / 100
1178 ms 1248 KB
#include <bits/stdc++.h>
#define y e[x][i]
using namespace std;
typedef vector<int> vec;
void dfs(int x,int fa,bool d,int&sum,const vector<vec> &e,vec&res){
	if(d) res[x]=sum++;
	for(int i=0;i<e[x].size();i++)
		if(y!=fa) dfs(y,x,d^1,sum,e,res);
	if(!d) res[x]=sum++;
}
vec label(int n,int k,vec u,vec v){
	vec res(n);vector<vec> e(n,vec());
	for(int i=0;i<n-1;i++) {e[u[i]].push_back(v[i]);e[v[i]].push_back(u[i]);}
	int sum=0;dfs(0,-1,1,sum,e,res);return res;
}
int find_next_station(int s,int t,vec c){
	if(c[0]>s){
		if(t<s||c.back()<t) return c.back();
		return *lower_bound(c.begin(),c.end(),t);
	}
	if(t<c[0]||s<t) return c[0];
	return *(upper_bound(c.begin(),c.end(),t)-1);
}

Compilation message

stations.cpp: In function 'void dfs(int, int, bool, int&, const std::vector<std::vector<int> >&, vec&)':
stations.cpp:7:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |  for(int i=0;i<e[x].size();i++)
      |              ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 533 ms 960 KB Output is correct
2 Correct 445 ms 968 KB Output is correct
3 Correct 987 ms 756 KB Output is correct
4 Correct 670 ms 884 KB Output is correct
5 Correct 676 ms 756 KB Output is correct
6 Correct 479 ms 884 KB Output is correct
7 Correct 474 ms 992 KB Output is correct
8 Correct 3 ms 876 KB Output is correct
9 Correct 5 ms 736 KB Output is correct
10 Correct 2 ms 736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 445 ms 736 KB Output is correct
2 Correct 515 ms 756 KB Output is correct
3 Correct 929 ms 736 KB Output is correct
4 Correct 666 ms 868 KB Output is correct
5 Correct 666 ms 756 KB Output is correct
6 Correct 442 ms 736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 513 ms 864 KB Output is correct
2 Correct 443 ms 952 KB Output is correct
3 Correct 936 ms 1052 KB Output is correct
4 Correct 703 ms 736 KB Output is correct
5 Correct 586 ms 868 KB Output is correct
6 Correct 460 ms 884 KB Output is correct
7 Correct 509 ms 1188 KB Output is correct
8 Correct 3 ms 868 KB Output is correct
9 Correct 5 ms 756 KB Output is correct
10 Correct 2 ms 756 KB Output is correct
11 Correct 612 ms 756 KB Output is correct
12 Correct 452 ms 864 KB Output is correct
13 Correct 464 ms 884 KB Output is correct
14 Correct 441 ms 1060 KB Output is correct
15 Correct 54 ms 756 KB Output is correct
16 Correct 59 ms 868 KB Output is correct
17 Correct 118 ms 880 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 891 ms 868 KB Output is correct
2 Correct 701 ms 868 KB Output is correct
3 Correct 590 ms 1028 KB Output is correct
4 Correct 3 ms 876 KB Output is correct
5 Correct 4 ms 736 KB Output is correct
6 Correct 1 ms 876 KB Output is correct
7 Correct 607 ms 736 KB Output is correct
8 Correct 913 ms 868 KB Output is correct
9 Correct 611 ms 736 KB Output is correct
10 Correct 560 ms 868 KB Output is correct
11 Correct 5 ms 908 KB Output is correct
12 Correct 5 ms 736 KB Output is correct
13 Correct 4 ms 736 KB Output is correct
14 Correct 4 ms 756 KB Output is correct
15 Correct 1 ms 756 KB Output is correct
16 Correct 536 ms 1012 KB Output is correct
17 Correct 490 ms 868 KB Output is correct
18 Correct 489 ms 756 KB Output is correct
19 Correct 499 ms 1188 KB Output is correct
20 Correct 470 ms 748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 540 ms 1024 KB Output is correct
2 Correct 446 ms 864 KB Output is correct
3 Correct 861 ms 736 KB Output is correct
4 Correct 666 ms 848 KB Output is correct
5 Correct 577 ms 876 KB Output is correct
6 Correct 486 ms 864 KB Output is correct
7 Correct 433 ms 1012 KB Output is correct
8 Correct 3 ms 756 KB Output is correct
9 Correct 4 ms 736 KB Output is correct
10 Correct 1 ms 756 KB Output is correct
11 Correct 523 ms 736 KB Output is correct
12 Correct 542 ms 756 KB Output is correct
13 Correct 1178 ms 876 KB Output is correct
14 Correct 738 ms 736 KB Output is correct
15 Correct 600 ms 1004 KB Output is correct
16 Correct 624 ms 1012 KB Output is correct
17 Correct 676 ms 868 KB Output is correct
18 Correct 547 ms 1248 KB Output is correct
19 Correct 554 ms 992 KB Output is correct
20 Correct 515 ms 756 KB Output is correct
21 Correct 51 ms 908 KB Output is correct
22 Correct 64 ms 736 KB Output is correct
23 Correct 102 ms 788 KB Output is correct
24 Correct 6 ms 756 KB Output is correct
25 Correct 6 ms 492 KB Output is correct
26 Correct 5 ms 736 KB Output is correct
27 Correct 4 ms 756 KB Output is correct
28 Correct 2 ms 908 KB Output is correct
29 Correct 506 ms 864 KB Output is correct
30 Correct 546 ms 868 KB Output is correct
31 Correct 597 ms 868 KB Output is correct
32 Correct 538 ms 736 KB Output is correct
33 Correct 570 ms 868 KB Output is correct
34 Correct 376 ms 960 KB Output is correct
35 Correct 422 ms 944 KB Output is correct
36 Correct 486 ms 980 KB Output is correct
37 Correct 477 ms 736 KB Output is correct
38 Correct 582 ms 756 KB Output is correct
39 Correct 566 ms 1004 KB Output is correct
40 Correct 465 ms 1004 KB Output is correct
41 Correct 635 ms 764 KB Output is correct
42 Correct 79 ms 808 KB Output is correct
43 Correct 131 ms 884 KB Output is correct
44 Correct 182 ms 792 KB Output is correct
45 Correct 153 ms 916 KB Output is correct
46 Correct 361 ms 756 KB Output is correct
47 Correct 321 ms 1008 KB Output is correct
48 Correct 80 ms 784 KB Output is correct
49 Correct 63 ms 924 KB Output is correct