Submission #1018307

# Submission time Handle Problem Language Result Execution time Memory
1018307 2024-07-09T18:43:03 Z vjudge1 Werewolf (IOI18_werewolf) C++17
15 / 100
4000 ms 23480 KB
#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma GCC target("popcnt")
#define endl '\n'
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fo(i,n) for(auto i =0 ; i < n;i++)
#define fore(i,l,r) for(auto i = l; i < r;i++)
#define forex(i,r,l) for(auto i = r; i >= l; i--)
#define ffo(i,n) forex(i,n-1,0)
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define sz(x) (int)x.size()
#define gcd(a,b) __gcd(a,b)
#define vii vector<ii>
#define pq_min(a) priority_queue<a, vector<a>, greater<a>>
#define fls cout.flush()
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using ii = pair<int,int>;
using mii = map<int,int>;
using lld = long double;
void valid(ll in){cout<<((in)?"YES\n":"NO\n");}
vi check_validity(int N, vi X, vi Y,vi S, vi E,vi L, vi R) {
    int Q = S.size(), M = sz(X);
    vi ans(Q,0);
    vector<vi> graph(N);
    fo(i,M)graph[X[i]].pb(Y[i]),graph[Y[i]].pb(X[i]);
    fo(i, Q){
        int l = L[i], r = R[i];
        vi ra(N, 0), rb(N, 0);
        queue<int> q;
        if(S[i] >= l)q.push(S[i]), ra[S[i]]=1;
        while(!q.empty()){
            int nodo = q.front();q.pop();
            for(int v : graph[nodo]){
                if(ra[v]==0&&v>=l){
                    q.push(v);
                    ra[v] = 1;
                }
            }
        }
        if(E[i] <= r)q.push(E[i]), rb[E[i]]=1;
        while(!q.empty()){
            int nodo = q.front();q.pop();
            for(int v : graph[nodo]){
                if(rb[v]==0&&v<=r){
                    q.push(v);
                    rb[v]=1;
                }
            }
        }
        fo(j,N)
            if(ra[j]&&rb[j])
                ans[i]=1;
    }
    return ans;
}
# 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 190 ms 876 KB Output is correct
11 Correct 101 ms 864 KB Output is correct
12 Correct 16 ms 860 KB Output is correct
13 Correct 216 ms 872 KB Output is correct
14 Correct 136 ms 880 KB Output is correct
15 Correct 168 ms 984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4054 ms 23480 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 596 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 190 ms 876 KB Output is correct
11 Correct 101 ms 864 KB Output is correct
12 Correct 16 ms 860 KB Output is correct
13 Correct 216 ms 872 KB Output is correct
14 Correct 136 ms 880 KB Output is correct
15 Correct 168 ms 984 KB Output is correct
16 Execution timed out 4054 ms 23480 KB Time limit exceeded
17 Halted 0 ms 0 KB -