Submission #310323

# Submission time Handle Problem Language Result Execution time Memory
310323 2020-10-06T16:29:01 Z Peacher29 Stations (IOI20_stations) C++14
100 / 100
1184 ms 1028 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:52:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |   for(int i=0;i<=c.size()-2;i++)
      |               ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 526 ms 1024 KB Output is correct
2 Correct 463 ms 1024 KB Output is correct
3 Correct 890 ms 648 KB Output is correct
4 Correct 666 ms 640 KB Output is correct
5 Correct 619 ms 640 KB Output is correct
6 Correct 502 ms 768 KB Output is correct
7 Correct 492 ms 792 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 5 ms 640 KB Output is correct
10 Correct 1 ms 648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 468 ms 1024 KB Output is correct
2 Correct 557 ms 816 KB Output is correct
3 Correct 980 ms 640 KB Output is correct
4 Correct 821 ms 640 KB Output is correct
5 Correct 663 ms 640 KB Output is correct
6 Correct 461 ms 812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 595 ms 1024 KB Output is correct
2 Correct 444 ms 1024 KB Output is correct
3 Correct 1184 ms 640 KB Output is correct
4 Correct 848 ms 640 KB Output is correct
5 Correct 579 ms 640 KB Output is correct
6 Correct 527 ms 1024 KB Output is correct
7 Correct 499 ms 780 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 6 ms 640 KB Output is correct
10 Correct 1 ms 640 KB Output is correct
11 Correct 684 ms 780 KB Output is correct
12 Correct 561 ms 1024 KB Output is correct
13 Correct 654 ms 1016 KB Output is correct
14 Correct 554 ms 808 KB Output is correct
15 Correct 54 ms 892 KB Output is correct
16 Correct 85 ms 768 KB Output is correct
17 Correct 129 ms 800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1041 ms 640 KB Output is correct
2 Correct 754 ms 660 KB Output is correct
3 Correct 606 ms 704 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 6 ms 640 KB Output is correct
6 Correct 2 ms 780 KB Output is correct
7 Correct 648 ms 648 KB Output is correct
8 Correct 987 ms 644 KB Output is correct
9 Correct 576 ms 640 KB Output is correct
10 Correct 598 ms 648 KB Output is correct
11 Correct 6 ms 800 KB Output is correct
12 Correct 6 ms 644 KB Output is correct
13 Correct 4 ms 640 KB Output is correct
14 Correct 4 ms 648 KB Output is correct
15 Correct 2 ms 908 KB Output is correct
16 Correct 558 ms 640 KB Output is correct
17 Correct 588 ms 644 KB Output is correct
18 Correct 676 ms 644 KB Output is correct
19 Correct 573 ms 648 KB Output is correct
20 Correct 528 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 632 ms 1024 KB Output is correct
2 Correct 528 ms 1024 KB Output is correct
3 Correct 1085 ms 640 KB Output is correct
4 Correct 777 ms 640 KB Output is correct
5 Correct 844 ms 768 KB Output is correct
6 Correct 479 ms 1024 KB Output is correct
7 Correct 453 ms 768 KB Output is correct
8 Correct 3 ms 644 KB Output is correct
9 Correct 5 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Correct 508 ms 1024 KB Output is correct
12 Correct 690 ms 804 KB Output is correct
13 Correct 1170 ms 640 KB Output is correct
14 Correct 965 ms 640 KB Output is correct
15 Correct 828 ms 640 KB Output is correct
16 Correct 434 ms 768 KB Output is correct
17 Correct 791 ms 644 KB Output is correct
18 Correct 445 ms 772 KB Output is correct
19 Correct 511 ms 1024 KB Output is correct
20 Correct 691 ms 768 KB Output is correct
21 Correct 60 ms 768 KB Output is correct
22 Correct 77 ms 768 KB Output is correct
23 Correct 131 ms 1028 KB Output is correct
24 Correct 4 ms 640 KB Output is correct
25 Correct 7 ms 832 KB Output is correct
26 Correct 6 ms 904 KB Output is correct
27 Correct 5 ms 648 KB Output is correct
28 Correct 2 ms 640 KB Output is correct
29 Correct 679 ms 640 KB Output is correct
30 Correct 680 ms 644 KB Output is correct
31 Correct 694 ms 760 KB Output is correct
32 Correct 687 ms 640 KB Output is correct
33 Correct 571 ms 656 KB Output is correct
34 Correct 327 ms 1024 KB Output is correct
35 Correct 563 ms 1024 KB Output is correct
36 Correct 643 ms 1008 KB Output is correct
37 Correct 617 ms 1024 KB Output is correct
38 Correct 473 ms 1024 KB Output is correct
39 Correct 556 ms 1024 KB Output is correct
40 Correct 523 ms 1024 KB Output is correct
41 Correct 433 ms 796 KB Output is correct
42 Correct 88 ms 828 KB Output is correct
43 Correct 127 ms 800 KB Output is correct
44 Correct 124 ms 768 KB Output is correct
45 Correct 156 ms 768 KB Output is correct
46 Correct 287 ms 820 KB Output is correct
47 Correct 290 ms 780 KB Output is correct
48 Correct 69 ms 792 KB Output is correct
49 Correct 59 ms 804 KB Output is correct