Submission #204317

# Submission time Handle Problem Language Result Execution time Memory
204317 2020-02-25T12:02:08 Z kshitij_sodani Split the Attractions (IOI19_split) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int llo;
#include <split.h>;
#define mp make_pair
#define pb push_back
#define a first
#define b second
vector<llo> adj[200001];
vector<llo> stac;
llo bb;
int vis[200001];
void dfs(llo no){
	stac.pb(no);
	if(stac.size()==bb){
		return ;
	}
	for(llo j=0;j<adj[no].size();j++){
		if(stac.size()==bb){
				return;
			}
		llo nn=adj[no][j];
		if(vis[nn]==0){
			dfs(nn);
			
		}
	}
}
vector<llo> find_split(llo n,llo a,llo b,llo c,vector<llo> p,vector<llo> q){
	llo m=p.size();
	bb=b;
	memset(vis,0,sizeof(vis));
	for(llo i=0;i<m;i++){
		adj[p[i]].pb(q[i]);
		adj[q[i]].pb(p[i]);
	}
	if(a==1){
		dfs(0);
		llo st=1;
		vector<llo> ans;
		for(int i=0;i<n;i++){
			ans.pb(0);
		}
		for(llo j=0;j<b;j++){
			ans[stac[j]]=(llo)2;

		}
		for(llo i=0;i<n;i++){
			if(ans[i]==(llo)2){
				continue;
			}
			ans[i]=st;
			st=3;
		}
		return ans;
	}
}
/*int main(){

	return 0;
}*/

Compilation message

split.cpp:5:19: warning: extra tokens at end of #include directive
 #include <split.h>;
                   ^
split.cpp: In function 'void dfs(llo)':
split.cpp:16:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(stac.size()==bb){
     ~~~~~~~~~~~^~~~
split.cpp:19:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(llo j=0;j<adj[no].size();j++){
              ~^~~~~~~~~~~~~~~
split.cpp:20:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(stac.size()==bb){
      ~~~~~~~~~~~^~~~
split.cpp: In function 'std::vector<long long int> find_split(llo, llo, llo, llo, std::vector<long long int>, std::vector<long long int>)':
split.cpp:58:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/tmp/ccMlAaNr.o: In function `main':
grader.cpp:(.text.startup+0x294): undefined reference to `find_split(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status