Submission #741594

# Submission time Handle Problem Language Result Execution time Memory
741594 2023-05-14T12:43:38 Z bane Wall (IOI14_wall) C++17
Compilation error
0 ms 0 KB
#include "dreaming.h"
#include<bits/stdc++.h>
using namespace std;
const int maxN = (int)1e5 + 5;
int sz[maxN], link[maxN];

inline void Init(){
	for (int i = 0; i < maxN; i++){
		sz[i] = 1;
		link[i] = i;
	}
}

inline int get(int a){
	while(a != link[a])a = link[a];
	return a;
}	

inline bool Merge(int a, int b){
	a = get(a), b = get(b);
	if (a == b)return 0;
	if (sz[a] < sz[b])swap(a,b);
	sz[a] += sz[b];
	link[b] = a;
	return true;
}

int travelTime(int N, int M, int L, int A[], int B[], int T[]) {
	Init();
	vector<vector<int>>adj(N);
	//vrzi gi zaedno tie sto mozat
	for (int i = 0 ; i < N; i++){
		Merge(A[i], B[i]);
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	//compress
	int flag[N], deg[N];
	memset(flag, 0, sizeof(flag)); memset(deg, 0, sizeof(deg));
	vector<int>nodes[N];
	for (int i = 0;  i < N; i++){
		nodes[get(i)].push_back(i);
	}
	vector<int>centroid;
	int maxima = 0;
	for (int i = 0 ; i < N; i++){
		int root = get(i);
		if (flag[root])continue;
		flag[root] = 1;
		for (int& x : nodes[root]){
			deg[x]+=(int)adj[x].size();
		}
		queue<int>q;
		for (int& x : nodes[root]){
			if (deg[x] == 1)q.push(x);
		}
		int mx = 0;
		while(!q.empty()){
			int node = q.front();
			q.pop();
			for (int& x : adj[node]){
				deg[x]--;
				if (deg[x] == 1){
					flag[x] = flag[node] + 1;
					mx = max(mx, flag[x]);
					q.push(x);
				}
			}
		}
		vector<int>pos;
		for (int& x : nodes[root]){
			if (flag[x] == mx){
				pos.push_back(x);
			}
		}
		centroid.push_back(pos[0]);
	}
	for (int& start : centroid){
		queue<pair<int,int>>q;
		q.push(start);
		unordered_map<int,int>visited;
		while(!q.empty()){
			int node = q.front().first;
			int dist = q.front().second;
			q.pop();
			
		}
	}
	return 0;
}


int main(){
	
}

Compilation message

wall.cpp:1:10: fatal error: dreaming.h: No such file or directory
    1 | #include "dreaming.h"
      |          ^~~~~~~~~~~~
compilation terminated.