제출 #289656

#제출 시각아이디문제언어결과실행 시간메모리
289656DanerZein늑대인간 (IOI18_werewolf)C++14
15 / 100
4059 ms34952 KiB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
int l,r;
bitset<200010> vh,vw;
vector<vi> G;
void dfs_human(int u){
  if(u<l) return;
  vh[u]=1;
  for(auto &v:G[u]){
    if(!vh[v]){
      dfs_human(v);
    }
  }
}
void dfs_wolf(int u){
  if(u>r) return;
  vw[u]=1;
  for(auto &v:G[u]){
    if(!vw[v]){
      dfs_wolf(v);
    }
  }
}
std::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) {
  G.resize(N+1);
  for(int i=0;i<X.size();i++){
    int u=X[i],v=Y[i];
    G[u].push_back(v);
    G[v].push_back(u);
  }
  vector<int> res;
  for(int i=0;i<S.size();i++){
    l=L[i];
    r=R[i];
    vh.reset();
    vw.reset();
    dfs_human(S[i]);
    dfs_wolf(E[i]);
    bool sw=0;
    for(int i=0;i<N;i++){
      if(vh[i]==1 and vw[i]==1){
	sw=1;
	break;
      }
    }
    res.push_back(sw);
  }
  return res;
}

컴파일 시 표준 에러 (stderr) 메시지

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:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int i=0;i<X.size();i++){
      |               ~^~~~~~~~~
werewolf.cpp:36:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |   for(int i=0;i<S.size();i++){
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...