Submission #305698

# Submission time Handle Problem Language Result Execution time Memory
305698 2020-09-23T20:10:00 Z arthurconmy Stations (IOI20_stations) C++14
0 / 100
4 ms 624 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);
		if(labellist[v]==0)
		{
			curv = int(curv/1000);
			curv++;
			curv *= 1000;
		}
	}
}

vector<int> label(int n, int k, vector<int> U, vector<int> V) 
{
	for(int i=0; i<n-1; i++)
	{
		adj[U[i]].push_back(V[i]);
		adj[V[i]].push_back(U[i]);
	}

	vector<int> labels(n);

	for(int i=0; i<n; i++)
	{
		if(i==n-1 || adj[i].size()>=3)
		{
			curv=-1;
			dfs(i);
			break;
		}
	}

	return labels;
}

int find_next_station(int s, int t, vector<int> C) 
{
	if(C.size()==1) return C[0];

	if(s==0)
	{
		int cur = int(t/1000);
		cur*=1000;
		return cur;
	}

	if(t==0)
	{
		return C[0];
	}

	if(int(s/1000) == int(t/1000))
	{
		if(s<t) return C[1];
		else return C[0];
	}

	return C[0];
}

#ifdef ARTHUR_LOCAL
int main()
{
	cout << "ANS: " << find_next_station(0, 6, {1, 2}) << endl; 
}
#endif
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 624 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 504 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 512 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -