Submission #420371

# Submission time Handle Problem Language Result Execution time Memory
420371 2021-06-08T10:14:10 Z A_D Werewolf (IOI18_werewolf) C++14
0 / 100
4000 ms 28112 KB
#include "werewolf.h"

#include <bits/stdc++.h>

using namespace std;
const int N=2e5+100;
vector<int> g[N];
bool vis[N][2];
int l,r;
bool ok(int u,int f)
{
    if(f==1){
        if(u>r)return 0;
    }
    else{
        if(u<l)return 0;
    }
    return 1;
}
void dfs(int u,int f)
{
    vis[u][f]=1;
    if(l<=u&&u<=r&&f==0){
        dfs(u,1);
    }
    for(auto x:g[u]){
        if(vis[x][f])continue;
        if(ok(x,f)){
            dfs(x,f);
        }
    }
}
vector<int> check_validity(int N,vector<int> X,vector<int> Y,vector<int> S,vector<int> E,vector<int> L,vector<int> R){
    vector<int> ret;
    for(int i=0;i<X.size();i++){
        g[X[i]].push_back(Y[i]);
    }
    for(int t=0;t<S.size();t++){
        for(int i=0;i<=N;i++){
            vis[i][0]=0;
            vis[i][1]=0;
        }
        l=L[t];
        r=R[t];
        dfs(S[t],0);
        if(vis[E[t]][1]){
            ret.push_back(1);
        }
        else{
            ret.push_back(0);
        }
    }
    return ret;
}

Compilation message

werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:35:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for(int i=0;i<X.size();i++){
      |                 ~^~~~~~~~~
werewolf.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for(int t=0;t<S.size();t++){
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4070 ms 28112 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -