Submission #1076963

# Submission time Handle Problem Language Result Execution time Memory
1076963 2024-08-26T19:51:04 Z ArthuroWich Parachute rings (IOI12_rings) C++17
0 / 100
4000 ms 10076 KB
#include<bits/stdc++.h>
using namespace std;
vector<int> adj[200005], vis;
int n, ans = 0;
bool f = 1;
void Init(int N_) {
    n = N_;
    ans = n;
}
void dfs(int i, int p, int s) {
    if (vis[i]) {
        f = 0;
        return;
    }
    vis[i] = 1;
    for (int j : adj[i]) {
        if (j == p || j == s) {
            continue;
        }
        dfs(j, i, s);
    }
}
int calc(int a) {
    vis.resize(n, 0);
    vector<int> co(n, 0);
    for (int j : adj[a]) {
        co[j]++;
    }
    f = 1;
    for (int i = 0; i < n; i++) {
        if (i != a && adj[i].size()-co[i] > 2) {
            f = 0;
            break;
        }
        if (vis[i] || i == a) {
            continue;
        }
        dfs(i, -1, a);
    }
    vis.clear();
    return f;
}
void Link(int A, int B) {
    adj[A].push_back(B);
    adj[B].push_back(A);
    ans = 0;
    for (int i = 0; i < n; i++) {
        ans += calc(i);
    }
}
int CountCritical() {
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 5208 KB Output is correct
2 Execution timed out 4064 ms 4956 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 10076 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 5208 KB Output is correct
2 Execution timed out 4064 ms 4956 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 5208 KB Output is correct
2 Execution timed out 4064 ms 4956 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 5208 KB Output is correct
2 Execution timed out 4064 ms 4956 KB Time limit exceeded
3 Halted 0 ms 0 KB -