Submission #595895

# Submission time Handle Problem Language Result Execution time Memory
595895 2022-07-14T07:56:12 Z fuad27 Parachute rings (IOI12_rings) C++17
0 / 100
750 ms 200560 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 5010;
int n;
vector<int> g[N];
vector<vector<int>> v(N, vector<int> (N,0));
void Init(int N_) {
	n = N_;
}

void Link(int A, int B) {
	if(v[A][B])return;
	g[A].push_back(B);
	g[B].push_back(A);
	v[A][B]=1;
	v[B][A]=1;
}
int cur;
bool check;
bool vis[N];
void dfs(int at) {
	if(vis[at])return;
	vis[at]=1;
	int viscnt=0, cnt=0;
	for(int to:g[at]) {
		if(vis[to] and to!=cur)viscnt++;
		else if(to!=cur){
			cnt++;
			dfs(to);
		}
	}
	if(cnt > 1 or viscnt > 1)check=false;
	vis[at]=1;
}
int CountCritical() {
	int ans=0;
	for(int j = 0;j<n;j++) {
		cur=j;
		check=1;
		for(int i = 0;i<n;i++)vis[i]=0;
		for(int i = 0;i<n;i++) {
			if(i == j)continue;
			int deg=0;
			for(int j:g[i]) {
				if(j!=cur)deg++;
			}
			if(deg==1){
				dfs(i);
			}
		}
		ans+=check;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 48 ms 98764 KB Output is correct
2 Correct 550 ms 99012 KB Output is correct
3 Correct 750 ms 99068 KB Output is correct
4 Incorrect 68 ms 98732 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 139 ms 200560 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 98764 KB Output is correct
2 Correct 550 ms 99012 KB Output is correct
3 Correct 750 ms 99068 KB Output is correct
4 Incorrect 68 ms 98732 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 98764 KB Output is correct
2 Correct 550 ms 99012 KB Output is correct
3 Correct 750 ms 99068 KB Output is correct
4 Incorrect 68 ms 98732 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 98764 KB Output is correct
2 Correct 550 ms 99012 KB Output is correct
3 Correct 750 ms 99068 KB Output is correct
4 Incorrect 68 ms 98732 KB Output isn't correct
5 Halted 0 ms 0 KB -