Submission #350453

# Submission time Handle Problem Language Result Execution time Memory
350453 2021-01-19T05:55:50 Z amunduzbaev Parachute rings (IOI12_rings) C++14
Compilation error
0 ms 0 KB
#include "grader.cpp"
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define ss second
#define ff first

const int N = 5e3+5;
int n;
vector<pair<int, int>> edges[N];
int used[N], vis[N];

void Init(int nn) { n = nn; }

int last;
void Link(int A, int B) {
	edges[A].pb({B, ++last});
	edges[B].pb({A, last});
}

bool dfs(int u){
	if(vis[u]) return 0;
	int cnt = 0;
	for(auto x:edges[u]){
		if(used[x.ss]) continue;
		if(cnt) return 0;
		cnt++; 
		dfs(x.ff);
	}return 1;
}

int CountCritical(){
	int cnt = 0;
	for(int i=0;i<n;i++){
		for(auto x:edges[i]) used[x.ss] = 1;
		vis[i] = 1;
		bool ok = 1;
		for(int j=0;j<n && ok;j++){
			if(!vis[j]){
				int cnt = 0;
				for(auto x:edges[j]){
					if(used[x.ss]) continue;
					cnt++;
					ok &= dfs(x.ff);
				}
				if(cnt > 2) ok = 0;
			}
		}
		for(auto x:edges[i]) used[x.ss] = 0;
		memset(vis, 0, sizeof vis);
		cnt += ok;
	}
	return cnt;
}

Compilation message

/tmp/ccWc7l89.o: In function `main':
rings.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccFQ8iBj.o:grader.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status