Submission #599036

# Submission time Handle Problem Language Result Execution time Memory
599036 2022-07-19T09:24:49 Z proma Werewolf (IOI18_werewolf) C++17
0 / 100
154 ms 19620 KB
#include "werewolf.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 3005;

vector <int> g[N];
int used[N];

void dfs(int v, int x, int l, int r, int wolf = 0) {
    if (!wolf and v < l) return;
    if (v == x) wolf = 1;
    if (wolf and v > r) return;
    used[v] = 1;
    for (auto i: g[v]) {
        if (!used[i]) {
            dfs(i, x, l, r, wolf);
        }
    }
}

vector<int> check_validity(int N, vector<int> X, vector<int> Y,
                                vector<int> S, vector<int> E,
                                vector<int> L, vector<int> R) {
    for (int i = 0; i < N; i ++) {
        g[X[i]].push_back(Y[i]);
        g[Y[i]].push_back(X[i]);
    }
    int Q = S.size();
    vector<int> A(Q);
    for (int i = 0; i < Q; ++i) {
        A[i] = 0;
        for (int j = 0; j < N; j ++) {
            memset(used, 0, sizeof(used));
            dfs(S[i], j, L[i], R[i]);
            if (used[E[i]]) A[i] = 1;
        }
    }
    return A;
}
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 154 ms 19620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -