Submission #310309

# Submission time Handle Problem Language Result Execution time Memory
310309 2020-10-06T15:39:20 Z Peacher29 Stations (IOI20_stations) C++14
0 / 100
2 ms 640 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);
}
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());
	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];
				}
			}
			exit(255);
		}
	} else {
		if(t>s || c[1]>t){
			return c[0];
		} else {
			for(int i=c.size()-2;i>=0;i--){
				if(t<=c[i]){
					return c[i];
				}
			}
			exit(255);
		}

	}
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
   41 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 416 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -