Submission #410923

# Submission time Handle Problem Language Result Execution time Memory
410923 2021-05-23T22:36:11 Z abdzag Werewolf (IOI18_werewolf) C++17
0 / 100
4000 ms 21372 KB
#include<bits/stdc++.h>
#include<unordered_map>
#include "werewolf.h"
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define rrep(i,a,b) for(int i=int(a);i>int(b);i--)
#define all(v) v.begin(),v.end()
#define trav(a,v) for(auto&a:v)
#define  sz(a) a.size()
typedef long double ld;
using namespace std;
static const long long inf = 1e15;
typedef long long ll;
typedef unsigned long long ull;
vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
    std::vector<int> S, std::vector<int> E,
    std::vector<int> L, std::vector<int> R) {
    vector < vector<ll>> g(N);
    rep(i, 0, X.size()) {
        g[X[i]].push_back(Y[i]);
        g[Y[i]].push_back(X[i]);
    }
    vector<int> ans(E.size());
    rep(i, 0, E.size()) {
        queue<ll> q;
        vector<bool> visited(N);
        q.emplace(E[i]);
        if (E[i] <= L[i]) {
            ans[i] = 0;
            continue;
        }
        while (!q.empty()) {
            ll cur = q.front();
            q.pop();
            trav(v, g[cur]) {
                if (v > L[i] && !visited[v]) {
                    visited[v] = 1;
                    q.emplace(v);
                }
            }
        }
        vector<bool> visited2(N);
        q.emplace(S[i]);
        if (S[i] >= R[i]) {
            ans[i] = 0;
            continue;
        }
        while (!q.empty()) {
            ll cur = q.front();
            q.pop();
            trav(v, g[cur]) {
                if (v < R[i] && !visited2[v]) {
                    if (visited[v]) {
                        ans[i] = 1;
                        break;
                    }
                    visited2[v] = 1;
                    q.emplace(v);
                }
            }
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4067 ms 21372 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -