Submission #1186663

#TimeUsernameProblemLanguageResultExecution timeMemory
1186663the_coding_pooh기지국 (IOI20_stations)C++20
0 / 100
305 ms576 KiB
#include "stations.h"
#include <bits/stdc++.h>

#define uwu return

using namespace std;

#define all(x) x.begin(), x.end()

const int SIZE = 1e3 + 5;

vector <int> graph[SIZE];

vector <int> dfn;

int cnt = 0;

void dfs(int nd, int rt, bool tp){
	if(tp)
		dfn[nd] = cnt++;
	for(auto i:graph[nd]){
		if(i != rt)
			dfs(i, nd, tp ^ 1);
	}
	if(!tp)
		dfn[nd] = cnt++;
	return;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	dfn.clear();
	cnt = 0;
	vector<int> labels(n);
	dfn = labels;
	for (int i = 0; i < n; i++){
		graph[i].clear();
	}
	for (int i = 0; i < n - 1; i++){
		graph[u[i]].push_back(v[i]);
		graph[v[i]].push_back(u[i]);
	}
	dfs(0, -1, 0);
	uwu dfn;
}

int find_next_station(int s, int t, vector<int> c) {
	sort(all(c));
	if(c.size() == 1)
		return c[0];
	if (s <= c[0]){
		if(t <= s || t >= c[c.size() - 2])
			return c.back();
		auto it = lower_bound(all(c), t);
		return *it;
	}
	if(s >= c.back()){
		if(t <= c[1] || t >= s)
			return c[0];
		auto it = prev(lower_bound(all(c), t));
		return *it;
	}
}

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
   62 | }
      | ^
#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...