답안 #119775

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
119775 2019-06-22T09:10:44 Z ahmad_salah 낙하산 고리들 (IOI12_rings) C++17
0 / 100
4000 ms 41120 KB
#include <bits/stdc++.h>

using namespace std;

const int M = 1e6;
int n;
vector<int> adj[M];
bool v[M], ok;

void dfs(int node, int forb) {
    if (!v[node]) {
        v[node] = 1;

        int cnt = 0;
        for (int x : adj[node])
            if (x != forb)
                cnt++;

        if (cnt > 2) {
            ok = false;
            return;
        }

        for (int x : adj[node])
            if (x != forb)
                dfs(x, forb);
    }
}

void Init(int N) { n = N; }

void Link(int a, int b) {
    adj[a].push_back(b);
    adj[b].push_back(a);
}

int CountCritical() {
    int ans = 0;

    for (int i = 0; i < n; i++) {
        memset(v, 0, sizeof v);
        ok = true;

        for (int j = 0; j < n; j++)
            if (!v[j] && i != j)
                dfs(j, i);

        ans += ok;
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 24832 KB Output is correct
2 Correct 696 ms 25080 KB Output is correct
3 Correct 1006 ms 25080 KB Output is correct
4 Incorrect 84 ms 24832 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4013 ms 41120 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 24832 KB Output is correct
2 Correct 696 ms 25080 KB Output is correct
3 Correct 1006 ms 25080 KB Output is correct
4 Incorrect 84 ms 24832 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 24832 KB Output is correct
2 Correct 696 ms 25080 KB Output is correct
3 Correct 1006 ms 25080 KB Output is correct
4 Incorrect 84 ms 24832 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 24832 KB Output is correct
2 Correct 696 ms 25080 KB Output is correct
3 Correct 1006 ms 25080 KB Output is correct
4 Incorrect 84 ms 24832 KB Output isn't correct
5 Halted 0 ms 0 KB -