Submission #1012462

# Submission time Handle Problem Language Result Execution time Memory
1012462 2024-07-02T08:10:34 Z c2zi6 Werewolf (IOI18_werewolf) C++14
15 / 100
4000 ms 38636 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "werewolf.h"

int n;
VVI gp;

void dfs(int u, VI& vis, int mn, int mx) {
    vis[u] = true;
    for (int v : gp[u]) if (!vis[v]) {
        if (mn <= v && v <= mx) {
            dfs(v, vis, mn, mx);
        }
    }
}

VI check_validity(int N, VI X, VI Y, VI S, VI E, VI L, VI R) {
    n = N;
    gp = VVI(n);
    rep(i, X.size()) {
        gp[X[i]].pb(Y[i]);
        gp[Y[i]].pb(X[i]);
    }

    VI ansret;
    rep(i, S.size()) {
        auto[s, e, l, r] = make_tuple(S[i], E[i], L[i], R[i]);
        VI visa, visb;
        visa = visb = VI(n);
        dfs(s, visa, l, +2e9);
        dfs(e, visb, -2e9, r);
        /*cout << "visa: ";*/
        /*for (int x : visa) cout << x << " ";*/
        /*cout << endl;*/
        /*cout << "visb: ";*/
        /*for (int x : visb) cout << x << " ";*/
        /*cout << endl;*/
        bool ans = false;
        rep(u, n) if (visa[u] && visb[u]) ans = true;
        ansret.pb(ans);
    }
    return ansret;
}





Compilation message

werewolf.cpp: In function 'VI check_validity(int, VI, VI, VI, VI, VI, VI)':
werewolf.cpp:56:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   56 |         auto[s, e, l, r] = make_tuple(S[i], E[i], L[i], R[i]);
      |             ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 158 ms 892 KB Output is correct
11 Correct 60 ms 860 KB Output is correct
12 Correct 15 ms 860 KB Output is correct
13 Correct 166 ms 700 KB Output is correct
14 Correct 88 ms 860 KB Output is correct
15 Correct 158 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4067 ms 38636 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 158 ms 892 KB Output is correct
11 Correct 60 ms 860 KB Output is correct
12 Correct 15 ms 860 KB Output is correct
13 Correct 166 ms 700 KB Output is correct
14 Correct 88 ms 860 KB Output is correct
15 Correct 158 ms 856 KB Output is correct
16 Execution timed out 4067 ms 38636 KB Time limit exceeded
17 Halted 0 ms 0 KB -