Submission #310311

# Submission time Handle Problem Language Result Execution time Memory
310311 2020-10-06T15:57:24 Z Peacher29 Stations (IOI20_stations) C++14
0 / 100
1 ms 384 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;
		cout << er[i] << ' ';
	}
	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];
				}
			}
			//cout << "254\n";
			exit(254);
		}
	} 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];
				}
			}
			return c[1];
			//cout << "255\n";
			exit(255);
		}

	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Invalid length of array as the response of 'label'. scenario=0, n=10, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Invalid length of array as the response of 'label'. scenario=0, n=996, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Invalid length of array as the response of 'label'. scenario=0, n=2, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Invalid length of array as the response of 'label'. scenario=0, n=2, len=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Invalid length of array as the response of 'label'. scenario=0, n=3, len=0
2 Halted 0 ms 0 KB -