답안 #676136

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
676136 2022-12-29T12:28:02 Z coding_snorlax 늑대인간 (IOI18_werewolf) C++14
0 / 100
179 ms 50780 KB
#include<bits/stdc++.h>
#include "werewolf.h"
using namespace std;
vector<int> G[200002];
int vis1[3002]={0};
int vis2[3002]={0};
int dfs_L(int node,int Left_bound){
    vis1[node]=1;
    for(int i:G[node]) {if(!vis1[i] && i>=Left_bound) dfs_L(i,Left_bound);};
}
int dfs_R(int node,int Right_bound){
    vis2[node]=1;
    for(int i:G[node]) {if(!vis2[i] && i<=Right_bound) dfs_R(i,Right_bound);};
}
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> answer;
    for(int i=0;i<(int)X.size();i++){G[X[i]].push_back(Y[i]);G[Y[i]].push_back(X[i]);}
    for(int i=0;i<(int)S.size();i++){
        for(int j=0;j<N;j++) vis1[j]=0;
        dfs_L(S[i],L[i]);
        for(int j=0;j<N;j++) vis2[j]=0;
        dfs_R(E[i],R[i]);
        int flag=0;
        for(int i=0;i<N;i++){
            if(vis1[i]&&vis2[i]) flag=1;
        }
        if(flag) answer.push_back(1);
        else answer.push_back(0);
    }
    return answer;
}

Compilation message

werewolf.cpp: In function 'int dfs_L(int, int)':
werewolf.cpp:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
werewolf.cpp: In function 'int dfs_R(int, int)':
werewolf.cpp:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
   14 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 9940 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 9940 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 179 ms 50780 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 9940 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -