Submission #62422

# Submission time Handle Problem Language Result Execution time Memory
62422 2018-07-28T12:26:14 Z zetapi Parachute rings (IOI12_rings) C++14
0 / 100
8 ms 6012 KB
#include <bits/stdc++.h>
using namespace std;

#define pb  push_back
#define mp  make_pair
#define ll long long
#define itr ::iterator 

typedef pair<int,int>  pii;

const int MAX=1e5;

vector<int> cur,vec[MAX];

int N,mark[MAX];

void Init(int N_) 
{
  	N=N_;
	for(int A=1;A<=N;A++)
	{
		mark[A]=0;
		vec[A].clear();
	}
	return ;
}

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

void dfs(int node,int br)
{
	cur.pb(node);
	mark[node]=1;
	for(auto A:vec[node])
	{
		if(mark[A] or A==br)
			continue;
		dfs(A,br);
	}
	return ;
}

int ok()
{
	int co=0,so=0,lo=0,e=0;
	for(auto A:cur)
	{
		e+=vec[A].size();
		if(vec[A].size()==1)
			co++;
		else if(vec[A].size()==2)
			so++;
		else 
			lo++;
	}
	if(e/2>=cur.size())
		return 0;
	return (co<=2 and lo==0);
}

int CountCritical() 
{
	int res=0;
	for(int A=1;A<=N;A++)
	{
		for(int B=1;B<=N;B++)
			mark[B]=0;
		for(int B=1;B<=N;B++)
		{
			if(!mark[B] and (A!=B))
			{
				cur.clear();
				dfs(B,A);
				res+=ok();
			}
		}
	}
  	return res;
}

/*signed main()
{
	ios_base::sync_with_stdio(false);

	
	return 0;
}*/

Compilation message

rings.cpp: In function 'int ok()':
rings.cpp:63:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(e/2>=cur.size())
     ~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 6012 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Output isn't correct
2 Halted 0 ms 0 KB -