Submission #509970

# Submission time Handle Problem Language Result Execution time Memory
509970 2022-01-14T12:59:21 Z jamezzz Stations (IOI20_stations) C++17
0 / 100
3000 ms 456 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

vector<int> l,AL[1005];
int deg[1005];

vector<int> label(int n,int k,vector<int> u,vector<int> v){
	l.resize(n,-1);
	for(int i=0;i<n;++i){
		AL[i].clear();
		deg[i]=0;
	}
	for(int i=0;i<n-1;++i){
		++deg[u[i]];
		++deg[v[i]];
		AL[u[i]].pb(v[i]);
		AL[v[i]].pb(u[i]);
	}
	for(int i=0;i<n;++i){
		if(deg[i]==1){
			int u=i;
			l[u]=0;
			while(true){
				for(int v:AL[u]){
					if(l[v]==-1){
						l[v]=l[u]+1;
						u=v;break;
					}
				}
				if(AL[u].size()==1)break;
			}
			break;
		}
	}
	return l;
}

int find_next_station(int s,int t,vector<int> c){
	if(c.size()==1)return c[0];
	if(s>t&&s>c[0])return c[0];
	if(s>t&&s>c[1])return c[1];
	if(s<t&&s<c[0])return c[0];
	if(s<t&&s<c[1])return c[1];
	return c[0];
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3080 ms 328 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 328 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=4, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3061 ms 320 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 904 ms 456 KB Output is correct
2 Incorrect 1 ms 200 KB Invalid labels (duplicates values). scenario=1, label=0
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3073 ms 316 KB Time limit exceeded
2 Halted 0 ms 0 KB -