답안 #310321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
310321 2020-10-06T16:26:34 Z Peacher29 기지국 (IOI20_stations) C++14
100 / 100
1214 ms 1088 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

class pont{
public:
	vector<int> v;
	bool volt = 0;
	int id=-1;
	int ind;
	void dfs(bool mi);
};

int dd;
vector<pont> p;
vector<int> er;

void pont::dfs(bool mi){
	if(!volt){
		volt=1;
		if(!mi)
			er[ind]=++dd;
		for(int i : v)
			p[i].dfs(!mi);
		if(mi)
			er[ind]=++dd;
	}
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	p.clear();
	p.resize(n);
	er.resize(n);
	dd=-1;
	for(int i=0;i<n-1;i++){
		p[i].ind=i;
		p[u[i]].v.push_back(v[i]);
		p[v[i]].v.push_back(u[i]);
	}
	p[n-1].ind=n-1;
	p[0].dfs(0);
	return er;
}
int find_next_station(int s, int t, vector<int> c) {
	if(c.size()==1){
		return c[0];
	}
	sort(c.begin(), c.end());
	if(s<c[0]){
		if(t<s || c[c.size()-2]<t)
			return c[c.size()-1];
		for(int i=0;i<=c.size()-2;i++)
			if(t<=c[i])
				return c[i];
	} else {
		if(t>s || c[1]>t)
			return c[0];
		for(int i=c.size()-1;i>=(s!=0);i--)
			if(c[i]<=t)
				return c[i];
	}
	exit(255);
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:53:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |   for(int i=0;i<=c.size()-2;i++)
      |               ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 542 ms 1024 KB Output is correct
2 Correct 571 ms 1024 KB Output is correct
3 Correct 1033 ms 640 KB Output is correct
4 Correct 658 ms 640 KB Output is correct
5 Correct 796 ms 776 KB Output is correct
6 Correct 459 ms 768 KB Output is correct
7 Correct 501 ms 768 KB Output is correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 5 ms 644 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 588 ms 1024 KB Output is correct
2 Correct 646 ms 804 KB Output is correct
3 Correct 932 ms 644 KB Output is correct
4 Correct 885 ms 640 KB Output is correct
5 Correct 630 ms 640 KB Output is correct
6 Correct 548 ms 808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 751 ms 1024 KB Output is correct
2 Correct 541 ms 1008 KB Output is correct
3 Correct 1061 ms 640 KB Output is correct
4 Correct 711 ms 644 KB Output is correct
5 Correct 794 ms 644 KB Output is correct
6 Correct 541 ms 768 KB Output is correct
7 Correct 634 ms 780 KB Output is correct
8 Correct 2 ms 652 KB Output is correct
9 Correct 6 ms 976 KB Output is correct
10 Correct 2 ms 656 KB Output is correct
11 Correct 601 ms 648 KB Output is correct
12 Correct 440 ms 1024 KB Output is correct
13 Correct 586 ms 1024 KB Output is correct
14 Correct 435 ms 768 KB Output is correct
15 Correct 56 ms 768 KB Output is correct
16 Correct 69 ms 840 KB Output is correct
17 Correct 100 ms 800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1007 ms 744 KB Output is correct
2 Correct 912 ms 648 KB Output is correct
3 Correct 848 ms 648 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 7 ms 772 KB Output is correct
6 Correct 1 ms 644 KB Output is correct
7 Correct 796 ms 640 KB Output is correct
8 Correct 1115 ms 644 KB Output is correct
9 Correct 653 ms 648 KB Output is correct
10 Correct 816 ms 648 KB Output is correct
11 Correct 7 ms 640 KB Output is correct
12 Correct 5 ms 640 KB Output is correct
13 Correct 5 ms 648 KB Output is correct
14 Correct 5 ms 640 KB Output is correct
15 Correct 1 ms 648 KB Output is correct
16 Correct 625 ms 640 KB Output is correct
17 Correct 764 ms 640 KB Output is correct
18 Correct 681 ms 644 KB Output is correct
19 Correct 541 ms 640 KB Output is correct
20 Correct 553 ms 648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 745 ms 1024 KB Output is correct
2 Correct 585 ms 1008 KB Output is correct
3 Correct 1214 ms 640 KB Output is correct
4 Correct 939 ms 640 KB Output is correct
5 Correct 845 ms 644 KB Output is correct
6 Correct 472 ms 1024 KB Output is correct
7 Correct 425 ms 768 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 3 ms 656 KB Output is correct
10 Correct 1 ms 640 KB Output is correct
11 Correct 475 ms 1024 KB Output is correct
12 Correct 783 ms 760 KB Output is correct
13 Correct 942 ms 640 KB Output is correct
14 Correct 714 ms 644 KB Output is correct
15 Correct 769 ms 760 KB Output is correct
16 Correct 635 ms 768 KB Output is correct
17 Correct 767 ms 772 KB Output is correct
18 Correct 487 ms 1024 KB Output is correct
19 Correct 658 ms 1008 KB Output is correct
20 Correct 572 ms 808 KB Output is correct
21 Correct 73 ms 768 KB Output is correct
22 Correct 90 ms 972 KB Output is correct
23 Correct 104 ms 768 KB Output is correct
24 Correct 6 ms 640 KB Output is correct
25 Correct 6 ms 640 KB Output is correct
26 Correct 5 ms 648 KB Output is correct
27 Correct 4 ms 640 KB Output is correct
28 Correct 2 ms 640 KB Output is correct
29 Correct 516 ms 648 KB Output is correct
30 Correct 601 ms 640 KB Output is correct
31 Correct 607 ms 648 KB Output is correct
32 Correct 690 ms 640 KB Output is correct
33 Correct 545 ms 640 KB Output is correct
34 Correct 316 ms 1008 KB Output is correct
35 Correct 462 ms 1024 KB Output is correct
36 Correct 552 ms 1024 KB Output is correct
37 Correct 489 ms 1008 KB Output is correct
38 Correct 596 ms 1024 KB Output is correct
39 Correct 505 ms 1024 KB Output is correct
40 Correct 460 ms 1088 KB Output is correct
41 Correct 507 ms 908 KB Output is correct
42 Correct 67 ms 752 KB Output is correct
43 Correct 110 ms 800 KB Output is correct
44 Correct 125 ms 936 KB Output is correct
45 Correct 173 ms 768 KB Output is correct
46 Correct 361 ms 828 KB Output is correct
47 Correct 310 ms 920 KB Output is correct
48 Correct 70 ms 800 KB Output is correct
49 Correct 67 ms 1024 KB Output is correct