Submission #1054728

# Submission time Handle Problem Language Result Execution time Memory
1054728 2024-08-12T11:48:09 Z LittleOrange Stations (IOI20_stations) C++17
5 / 100
521 ms 1016 KB
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
using ll = int;

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	vector<ll> labels(n);
	iota(labels.begin(),labels.end(),0);
	vector<vector<ll>> con(n);
	for(ll i = 0;i<n-1;i++){
		con[u[i]].push_back(v[i]);
		con[v[i]].push_back(u[i]);
	}
	fill(labels.begin(),labels.end(),-1);
	for(ll i = 0;i<n;i++){
		if (con[i].size()==1&&labels[i]==-1){
			ll cur = i;
			ll it = 0;
			while(cur!=-1){
				labels[cur] = it++;
				ll nxt = -1;
				for(ll j : con[cur]) if (labels[j]==-1) nxt = j;
				cur = nxt;
			}
		}
	}
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	/*s++;t++;
	ll lgs = __lg(s), lgt = __lg(t);
	if (lgs<lgt){
		ll x = t>>(lgt-lgs);
		if (s==x){
			return (t>>(lgt-lgs-1))-1;
		}
	}
	return (s>>1)-1;*/
	if (t>s) return s+1;
	else return s-1;
}
# Verdict Execution time Memory Grader output
1 Correct 279 ms 684 KB Output is correct
2 Correct 253 ms 684 KB Output is correct
3 Correct 503 ms 684 KB Output is correct
4 Correct 358 ms 684 KB Output is correct
5 Correct 312 ms 684 KB Output is correct
6 Correct 251 ms 684 KB Output is correct
7 Correct 243 ms 684 KB Output is correct
8 Correct 2 ms 776 KB Output is correct
9 Correct 1 ms 768 KB Output is correct
10 Correct 0 ms 764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 305 ms 776 KB Output is correct
2 Correct 220 ms 684 KB Output is correct
3 Correct 488 ms 684 KB Output is correct
4 Correct 378 ms 684 KB Output is correct
5 Correct 335 ms 684 KB Output is correct
6 Correct 267 ms 684 KB Output is correct
7 Correct 224 ms 688 KB Output is correct
8 Correct 2 ms 780 KB Output is correct
9 Correct 1 ms 780 KB Output is correct
10 Correct 0 ms 768 KB Output is correct
11 Incorrect 0 ms 344 KB Invalid labels (duplicates values). scenario=1, label=0
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 498 ms 684 KB Output is correct
2 Correct 380 ms 684 KB Output is correct
3 Correct 335 ms 684 KB Output is correct
4 Correct 1 ms 768 KB Output is correct
5 Correct 3 ms 768 KB Output is correct
6 Correct 0 ms 768 KB Output is correct
7 Incorrect 1 ms 344 KB Invalid labels (duplicates values). scenario=0, label=0
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 300 ms 684 KB Output is correct
2 Correct 242 ms 684 KB Output is correct
3 Correct 521 ms 684 KB Output is correct
4 Correct 382 ms 684 KB Output is correct
5 Correct 345 ms 684 KB Output is correct
6 Correct 254 ms 684 KB Output is correct
7 Correct 265 ms 684 KB Output is correct
8 Correct 0 ms 1016 KB Output is correct
9 Correct 1 ms 768 KB Output is correct
10 Correct 0 ms 768 KB Output is correct
11 Incorrect 2 ms 428 KB Invalid labels (values out of range). scenario=0, k=1000000000, vertex=0, label=-1
12 Halted 0 ms 0 KB -