답안 #350936

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
350936 2021-01-19T10:01:28 Z juggernaut 낙하산 고리들 (IOI12_rings) C++14
20 / 100
4000 ms 42760 KB
#ifndef EVAL
#include"grader.cpp"
#endif
#include<bits/stdc++.h>
using namespace std;
vector<int>g[1000005];
bool on[1000005],vis[1000005];
int n,deg[1000005];
bool flag;
#define DEBUG(x) cout<<#x<<"="<<x<<"\n"
void go(int v,int p){
    if(on[v])return;
    //cycle_size++;
    vis[v]=1;
    for(int to:g[v])if(to!=p){
        if(vis[to]){
            flag=true;
            continue;
        }
        go(to,v);
    }
}
bool check(){
    for(int i=0;i<n;i++)vis[i]=0;
    for(int i=0;i<n;i++){
        if(on[i])continue;
        if(deg[i]>2)return false;
        if(vis[i])continue;
        flag=false;
        go(i,i);
        if(flag)return false;
    }
    return true;
}
void Init(int N){
    n=N;
}
void Link(int x,int y){
    g[x].push_back(y);
    g[y].push_back(x);
    deg[x]++;
    deg[y]++;
}
int CountCritical(){
    int cnt=0;
    for(int i=0;i<n;i++){
        on[i]=true;
        for(int to:g[i])deg[i]--,deg[to]--;
        cnt+=check();
        for(int to:g[i])deg[i]++,deg[to]++;
        on[i]=false;
    }
    return cnt;
}
/*
7 13
-1
1 2
-1
0 5
-1
2 0
-1
3 2
-1
3 5
-1
4 3
-1

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 23916 KB Output is correct
2 Correct 507 ms 24172 KB Output is correct
3 Correct 728 ms 24192 KB Output is correct
4 Correct 25 ms 23916 KB Output is correct
5 Correct 195 ms 24080 KB Output is correct
6 Correct 662 ms 24396 KB Output is correct
7 Correct 74 ms 24044 KB Output is correct
8 Correct 76 ms 24172 KB Output is correct
9 Correct 502 ms 24172 KB Output is correct
10 Correct 620 ms 24076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4074 ms 42760 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 23916 KB Output is correct
2 Correct 507 ms 24172 KB Output is correct
3 Correct 728 ms 24192 KB Output is correct
4 Correct 25 ms 23916 KB Output is correct
5 Correct 195 ms 24080 KB Output is correct
6 Correct 662 ms 24396 KB Output is correct
7 Correct 74 ms 24044 KB Output is correct
8 Correct 76 ms 24172 KB Output is correct
9 Correct 502 ms 24172 KB Output is correct
10 Correct 620 ms 24076 KB Output is correct
11 Execution timed out 4091 ms 24344 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 23916 KB Output is correct
2 Correct 507 ms 24172 KB Output is correct
3 Correct 728 ms 24192 KB Output is correct
4 Correct 25 ms 23916 KB Output is correct
5 Correct 195 ms 24080 KB Output is correct
6 Correct 662 ms 24396 KB Output is correct
7 Correct 74 ms 24044 KB Output is correct
8 Correct 76 ms 24172 KB Output is correct
9 Correct 502 ms 24172 KB Output is correct
10 Correct 620 ms 24076 KB Output is correct
11 Execution timed out 4091 ms 24344 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 23916 KB Output is correct
2 Correct 507 ms 24172 KB Output is correct
3 Correct 728 ms 24192 KB Output is correct
4 Correct 25 ms 23916 KB Output is correct
5 Correct 195 ms 24080 KB Output is correct
6 Correct 662 ms 24396 KB Output is correct
7 Correct 74 ms 24044 KB Output is correct
8 Correct 76 ms 24172 KB Output is correct
9 Correct 502 ms 24172 KB Output is correct
10 Correct 620 ms 24076 KB Output is correct
11 Execution timed out 4074 ms 42760 KB Time limit exceeded
12 Halted 0 ms 0 KB -