Submission #624588

# Submission time Handle Problem Language Result Execution time Memory
624588 2022-08-08T13:58:09 Z moyindavid Parachute rings (IOI12_rings) C++17
0 / 100
1 ms 596 KB
#include <bits/stdc++.h>
using namespace std;

int N;
vector<int> v[2000];
int sz[2000]{0};

void Init(int N_) {

  N = N_;

}

void Link(int A, int B) {
    v[A].push_back(B);
    v[B].push_back(A);
    //sz[A]++;sz[B]++;
}

int CountCritical() {
    int ans=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(j==i)continue;

            queue<int> q;q.push(j);
            bool vis[N]{0}, flag=0;

            while(!q.empty()){
                int a=q.front();q.pop();
                int cnt=0;
                for(auto u: v[a]){
                    if(u==i)continue;
                    if(vis[u]==1)cnt++;
                    if(cnt>1 || v[a].size()>3){
                        flag=true;
                        break;
                    }
                }
                if(flag)break;
            }
            if(flag){
                ans--;
                break;
            }

        }
        ans++;
    }

    return ans;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 1 ms 596 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 596 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 1 ms 596 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 1 ms 596 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 1 ms 596 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -