Submission #1095724

# Submission time Handle Problem Language Result Execution time Memory
1095724 2024-10-03T03:42:02 Z Newtonabc Stations (IOI20_stations) C++14
8 / 100
618 ms 688 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+10;
int tmpcase1,cnt=0;
vector<int> adj[N],lb;
/*case1
void labelcase1(int u,int p){
	lb[u]=cnt++;
	for(int i=0;i<adj[u].size();i++){
		if(adj[u][i]!=p) labelcase1(adj[u][i],u);
	}
}*/
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	lb.resize(n);
	cnt=0;
	for(int i=0;i<n-1;i++){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	/*case1
	for(int i=0;i<n;i++){
		if(adj[i].size()==1) tmpcase1=i;
	}
	labelcase1(tmpcase1,-1);*/
	for(int i=0;i<n;i++) lb[i]=i;
	for(int i=0;i<n;i++) adj[i].clear();
	/*for(int i=0;i<lb.size();i++) cout<<lb[i] <<" ";
	cout<<"\n\n\n";*/
	return lb;
}

int find_next_station(int s, int t, vector<int> c) {
	/*case1
	if(c.size()==1) return c[0];
	if(s<t) return max(c[0],c[1]);
	return min(c[0],c[1]);*/
	int cnts=0,cntt=0,tmps=s+1,tmpt=t+1;
	s++,t++;
	while(tmps!=0) cnts++,tmps/=2;
	while(tmpt!=0) cntt++,tmpt/=2;
	if(cnts>cntt) return (s/2)-1;
	if(cntt>cnts){
		while(true){
			if(t==s*2) return s*2-1;
			if(t==s*2+1) return s*2;
			if(t==s || t<s) return s/2-1;
			t/=2;
		}
	}
	return s/2-1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 351 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 296 ms 684 KB Output is correct
2 Correct 370 ms 684 KB Output is correct
3 Correct 618 ms 684 KB Output is correct
4 Correct 427 ms 680 KB Output is correct
5 Correct 384 ms 684 KB Output is correct
6 Correct 337 ms 684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 387 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 574 ms 688 KB Output is correct
2 Incorrect 456 ms 684 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 325 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -