Submission #430223

# Submission time Handle Problem Language Result Execution time Memory
430223 2021-06-16T12:16:52 Z APROHACK Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>
#include <vector>
#define PB push_back
using namespace std;
vector<int>ady[100001];
int lab[100001];
long long cur = 0;
int dfs(int node, int parent){
	for(auto i:ady[node]){
		if(i==parent)continue;
		dfs(i, node);
	}
	lab[node]=cur++;
	return 1;
}
vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vector<int>ab;
	for(int i = 0 ; i < n-1 ; i++){
		ady[u[i]].PB(v[i]);
		ady[v[i]].PB(u[i]);
	}
	dfs(0, -1);
	for(int i = 0 ; i <= n-1 ; i++){
		ab.PB(lab[i]);
		//cout<<lab[i]<<" ";
	}
	return ab;
}

int find_next_station(int s, int t, std::vector<int> c) {
	int li=0, ls=c.size()-1, pos;
	for(int i = 0 ; i <= ls ; i++){
		cout<<c[i]<<" ";
	}
	cout<<endl<<s<<" "<<t<<endl;
	pos=(li+ls)/2;
	while(li+1<ls){
		//cout<<li<<" "<<ls<<endl;
		pos=(li+ls)/2;
		if(c[pos]>=t)ls=pos;
		else li=pos;
	}
	for(int i = ls ; i >= li ; i--){
		if(c[i]>=t)pos=i;
	}
	if(t>s)return c[c.size()-1];
	//pos=(li+ls)/2;
	cout<<"a "<<c[pos]<<endl;
	return c[pos];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1907 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3008 ms 2740 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2066 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 5280 KB Expected integer, but "a" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3188 ms 1642364 KB Time limit exceeded
2 Halted 0 ms 0 KB -