Submission #305693

# Submission time Handle Problem Language Result Execution time Memory
305693 2020-09-23T19:54:43 Z arthurconmy Stations (IOI20_stations) C++14
Compilation error
0 ms 0 KB
#ifndef ARTHUR_LOCAL
	#include "stations.h"
#endif

#ifdef ARTHUR_LOCAL
	#include <bits/stdc++.h>
#endif

using namespace std;
using ll = long long;

vector<int> adj[1001];
bool vis[1001];
int curv;
int labellist[1001];

void dfs(int v)
{
	vis[v]=1;
	labellist[v]=curv++;

	for(auto u:adj[v])
	{
		if(!vis[u]) dfs(u);
	}
}

vector<int> label(int n, int k, vector<int> U, vector<int> V) 
{
	vector<int> ans;
	for(int i=0; i<n; i++) ans.push_back(i);
	return ans;
}

int find_next_station(int s, int t, vector<int> C) 
{
	vector<int> level(1001);
	level[0]=1;

	for(int i=0; i<n; i++)
	{
		if(2*i + 1 <= 1000) level[2*i + 1] = 1 + level[i];
		if(2*i + 2 <= 1000) level[2*i + 2] = 1 + level[i];
	}

	if(s > t) return int((s-1)/2);

	int ss=s;
	while(ss > t) ss = int((ss-1)/2);
	if(ss!=t) return C[0];

	ss=s;
	while(int((ss-1)/2)!=t) ss=int((ss-1)/2);
	return ss;
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:40:17: error: 'n' was not declared in this scope
   40 |  for(int i=0; i<n; i++)
      |                 ^