제출 #1122195

#제출 시각아이디문제언어결과실행 시간메모리
1122195Luvidi늑대인간 (IOI18_werewolf)C++17
15 / 100
4057 ms33524 KiB
#include "werewolf.h" #include <bits/stdc++.h> using namespace std; const int maxn=2e5; vector<int> adj[maxn]; bool v1[maxn],v2[maxn]; void dfs1(int v,int l){ v1[v]=1; for(int u:adj[v])if(u>=l&&!v1[u])dfs1(u,l); } void dfs2(int v,int r){ v2[v]=1; for(int u:adj[v])if(u<=r&&!v2[u])dfs2(u,r); } 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) { for(int i=0;i<x.size();i++){ adj[x[i]].push_back(y[i]); adj[y[i]].push_back(x[i]); } vector<int> ans; for(int i=0;i<S.size();i++){ int s=S[i],e=E[i],l=L[i],r=R[i]; for(int j=0;j<n;j++)v1[j]=v2[j]=0; dfs1(s,l); dfs2(e,r); bool b=0; for(int j=0;j<n;j++)b|=v1[j]&&v2[j]; ans.push_back(b); } return ans; }

컴파일 시 표준 에러 (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:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i=0;i<x.size();i++){
      |                 ~^~~~~~~~~
werewolf.cpp:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     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...