Submission #310312

# Submission time Handle Problem Language Result Execution time Memory
310312 2020-10-06T15:59:24 Z Peacher29 Stations (IOI20_stations) C++14
5 / 100
1031 ms 1048 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

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

int dd;
vector<pont> p;

void pont::dfs(bool mi){
	if(id==-1){
		if(mi){
			id=-2;
		} else {
			id=++dd;
		}
		for(int i : v){
			p[i].dfs(!mi);
		}
		if(mi){
			id=++dd;
		}
	}
}

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

	}
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:81:1: warning: control reaches end of non-void function [-Wreturn-type]
   81 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 517 ms 1048 KB Output is correct
2 Correct 447 ms 1024 KB Output is correct
3 Correct 857 ms 760 KB Output is correct
4 Correct 750 ms 644 KB Output is correct
5 Correct 665 ms 644 KB Output is correct
6 Correct 446 ms 776 KB Output is correct
7 Correct 491 ms 784 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 5 ms 644 KB Output is correct
10 Correct 1 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 524 ms 1008 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 572 ms 1024 KB Output is correct
2 Correct 540 ms 1008 KB Output is correct
3 Correct 1031 ms 640 KB Output is correct
4 Correct 750 ms 640 KB Output is correct
5 Correct 588 ms 792 KB Output is correct
6 Correct 448 ms 784 KB Output is correct
7 Correct 451 ms 788 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 5 ms 640 KB Output is correct
10 Correct 2 ms 640 KB Output is correct
11 Incorrect 572 ms 1040 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 849 ms 784 KB Output is correct
2 Correct 659 ms 640 KB Output is correct
3 Correct 618 ms 640 KB Output is correct
4 Correct 3 ms 644 KB Output is correct
5 Correct 6 ms 600 KB Output is correct
6 Correct 1 ms 644 KB Output is correct
7 Correct 632 ms 768 KB Output is correct
8 Correct 980 ms 760 KB Output is correct
9 Correct 742 ms 768 KB Output is correct
10 Correct 652 ms 644 KB Output is correct
11 Incorrect 5 ms 644 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 608 ms 768 KB Output is correct
2 Correct 575 ms 1024 KB Output is correct
3 Correct 887 ms 652 KB Output is correct
4 Correct 791 ms 652 KB Output is correct
5 Correct 769 ms 776 KB Output is correct
6 Correct 580 ms 768 KB Output is correct
7 Correct 481 ms 804 KB Output is correct
8 Correct 2 ms 652 KB Output is correct
9 Correct 5 ms 640 KB Output is correct
10 Correct 1 ms 640 KB Output is correct
11 Incorrect 571 ms 1008 KB Wrong query response.
12 Halted 0 ms 0 KB -