Submission #509990

# Submission time Handle Problem Language Result Execution time Memory
509990 2022-01-14T13:22:39 Z jamezzz Stations (IOI20_stations) C++17
16 / 100
932 ms 676 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

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

int find_next_station(int s,int t,vector<int> c){
	if(s==0){
		int mod=c.size();
		if(t%mod==0)return c[mod-1];
		else return c[t%mod-1];
	}
	else if(c.size()==1){
		return c[0];
	}
	else{
		int mod=c.back()-s;
		if(t>s&&t%mod==s%mod)return c[1];
		else return c[0];
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 328 KB Invalid labels (values out of range). scenario=2, k=1000, vertex=5, label=1196
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 288 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=6, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 579 ms 560 KB Output is correct
2 Correct 386 ms 512 KB Output is correct
3 Correct 911 ms 400 KB Output is correct
4 Correct 628 ms 488 KB Output is correct
5 Correct 529 ms 488 KB Output is correct
6 Correct 417 ms 532 KB Output is correct
7 Correct 441 ms 544 KB Output is correct
8 Correct 2 ms 476 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 0 ms 468 KB Output is correct
11 Correct 557 ms 488 KB Output is correct
12 Correct 460 ms 676 KB Output is correct
13 Correct 519 ms 564 KB Output is correct
14 Correct 467 ms 528 KB Output is correct
15 Correct 50 ms 448 KB Output is correct
16 Correct 65 ms 484 KB Output is correct
17 Correct 117 ms 480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 910 ms 400 KB Output is correct
2 Correct 622 ms 400 KB Output is correct
3 Correct 599 ms 492 KB Output is correct
4 Correct 2 ms 480 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 0 ms 480 KB Output is correct
7 Correct 675 ms 400 KB Output is correct
8 Correct 932 ms 404 KB Output is correct
9 Correct 701 ms 400 KB Output is correct
10 Correct 628 ms 472 KB Output is correct
11 Incorrect 0 ms 200 KB Invalid labels (values out of range). scenario=5, k=1000000000, vertex=5, label=-1
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 532 ms 488 KB Partially correct
2 Partially correct 459 ms 484 KB Partially correct
3 Correct 871 ms 404 KB Output is correct
4 Correct 626 ms 400 KB Output is correct
5 Correct 576 ms 404 KB Output is correct
6 Partially correct 448 ms 528 KB Partially correct
7 Partially correct 378 ms 488 KB Partially correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 0 ms 464 KB Output is correct
11 Incorrect 5 ms 328 KB Invalid labels (values out of range). scenario=0, k=1000000000, vertex=6, label=-1
12 Halted 0 ms 0 KB -