Submission #62420

# Submission time Handle Problem Language Result Execution time Memory
62420 2018-07-28T12:21:31 Z zetapi Parachute rings (IOI12_rings) C++14
0 / 100
8 ms 6260 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) 
{
	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;
	for(auto A:cur)
	{
		if(vec[A].size()==1)
			co++;
		else if(vec[A].size()==2)
			so++;
		else 
			lo++;
	}
	if((co+so+lo)/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])
			{
				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:60:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if((co+so+lo)/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 6260 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 -