Submission #604938

#TimeUsernameProblemLanguageResultExecution timeMemory
604938HamletPetrosyanStations (IOI20_stations)C++17
8 / 100
854 ms548 KiB
#include "stations.h"
#include <vector>
#include <iostream>
using namespace std;

#define ll long long
#define add push_back
#define len(a) ((int)(a).size())

vector<int> g[1005];
vector<int> labels;
int timer = -2;

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	labels.resize(n);
	timer = 0;
	for(int i = 0; i < n; i++) {
		g[i].clear();
	}
	for(int i = 0; i < len(u); i++){
		g[u[i]].add(v[i]);
		g[v[i]].add(u[i]);
	}
	for(int i = 0; i < n; i++){
		labels[i] = i;
	}
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	s++;
	t++;
	int nt = t, x = 0;
	while(nt > 0){
		nt >>= 1;
		x++;
		if(nt == s){
			break;
		}
	}
	if(nt == s){
		while(x-- > 1){
			t >>= 1;
		}
		return t - 1;
	}

	return (s >> 1) - 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...