Submission #1078453

# Submission time Handle Problem Language Result Execution time Memory
1078453 2024-08-27T17:36:19 Z Trumling Stations (IOI20_stations) C++14
0 / 100
606 ms 684 KB
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std; 

typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
#define INF 99999999999999999
#define MOD 1000000007
#define all(x) x.begin(),x.end()

vector<vector<ll>>g;
vector<int> labels;

void dfs(int start,int pre)
{
	labels[start]=(1<<start);
	for(auto x:g[start])
		if(x!=pre)
		{
			dfs(x,start);
			labels[start]|=labels[x];
		}
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	
	
	g.assign(n,vector<ll>());
	labels.assign(n,0);
	for (int i = 0; i < n-1; i++) {
		g[u[i]].pb(v[i]);
		g[v[i]].pb(u[i]);
	}
	dfs(0,0);
	for(int i=0;i<n;i++)
		labels[i]+=i*256;
	

	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	
	ll S=s/256;
	ll T=t/256;

	ll par;
	vector<ll>v;
	for(auto x:c)
	{
		if((1<<S)&x)
			par=x;

		if((1<<T)&x)	
			v.pb(x);
	}

	if(v.size()<=1)
		return par;
	else
		return v[0]+v[1]-par;

}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:63:10: warning: 'par' may be used uninitialized in this function [-Wmaybe-uninitialized]
   63 |   return par;
      |          ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 344 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1023
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 572 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 Incorrect 3 ms 600 KB Invalid labels (values out of range). scenario=1, k=1000000, vertex=0, label=-1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 606 ms 684 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 600 KB Invalid labels (values out of range). scenario=1, k=1000000000, vertex=0, label=-1
2 Halted 0 ms 0 KB -