Submission #595977

# Submission time Handle Problem Language Result Execution time Memory
595977 2022-07-14T08:26:52 Z snasibov05 Parachute rings (IOI12_rings) C++14
20 / 100
4000 ms 35788 KB
#include "bits/stdc++.h"
using namespace std;

int n;
vector<vector<int>> ed;


void Init(int N_) {

    n = N_;
    ed.resize(n);

}

void Link(int A, int B) {

    ed[A].push_back(B);
    ed[B].push_back(A);
}

bool dfs(int cur, int pr, int crt, vector<bool>& visited){
    visited[cur] = true;
    for (auto to : ed[cur]){
        if (to == pr || to == crt) continue;
        if (visited[to]) return false;
        if (!dfs(to, cur, crt, visited)) return false;
    }

    return true;
}

int CountCritical() {

    int cnt = 0;
    for (int i = 0; i < n; ++i){

        bool flag = true;
        vector<bool> visited(n);
        for (int j = 0; j < n; ++j) {
            if (i == j || visited[j]) continue;
            flag = flag & dfs(j, j, i, visited);
        }

        for (int j = 0; j < n; ++j){
            if (i == j) continue;
            int deg = 0;
            for (auto to : ed[j]) {
                if (to == i) continue;
                deg++;
            }
            if (deg > 2) flag = false;
        }

        cnt += flag;

    }

    return cnt;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 881 ms 596 KB Output is correct
3 Correct 749 ms 672 KB Output is correct
4 Correct 22 ms 340 KB Output is correct
5 Correct 273 ms 616 KB Output is correct
6 Correct 737 ms 920 KB Output is correct
7 Correct 276 ms 436 KB Output is correct
8 Correct 375 ms 628 KB Output is correct
9 Correct 668 ms 720 KB Output is correct
10 Correct 676 ms 668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4083 ms 35788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 881 ms 596 KB Output is correct
3 Correct 749 ms 672 KB Output is correct
4 Correct 22 ms 340 KB Output is correct
5 Correct 273 ms 616 KB Output is correct
6 Correct 737 ms 920 KB Output is correct
7 Correct 276 ms 436 KB Output is correct
8 Correct 375 ms 628 KB Output is correct
9 Correct 668 ms 720 KB Output is correct
10 Correct 676 ms 668 KB Output is correct
11 Execution timed out 4017 ms 776 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 881 ms 596 KB Output is correct
3 Correct 749 ms 672 KB Output is correct
4 Correct 22 ms 340 KB Output is correct
5 Correct 273 ms 616 KB Output is correct
6 Correct 737 ms 920 KB Output is correct
7 Correct 276 ms 436 KB Output is correct
8 Correct 375 ms 628 KB Output is correct
9 Correct 668 ms 720 KB Output is correct
10 Correct 676 ms 668 KB Output is correct
11 Execution timed out 4017 ms 776 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 881 ms 596 KB Output is correct
3 Correct 749 ms 672 KB Output is correct
4 Correct 22 ms 340 KB Output is correct
5 Correct 273 ms 616 KB Output is correct
6 Correct 737 ms 920 KB Output is correct
7 Correct 276 ms 436 KB Output is correct
8 Correct 375 ms 628 KB Output is correct
9 Correct 668 ms 720 KB Output is correct
10 Correct 676 ms 668 KB Output is correct
11 Execution timed out 4083 ms 35788 KB Time limit exceeded
12 Halted 0 ms 0 KB -