제출 #805922

#제출 시각아이디문제언어결과실행 시간메모리
805922LIFWerewolf (IOI18_werewolf)C++14
15 / 100
4072 ms32256 KiB
#include "werewolf.h" #include<vector> #include<bits/stdc++.h> #include<queue> using namespace std; vector<int> vv[300005]; bool flag1[400005]; bool vis[300005]; bool flag2[300005]; bool vis2[30005]; vector<int> ans; 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++) { vv[X[i]].push_back(Y[i]); vv[Y[i]].push_back(X[i]); } for(int i=0;i<S.size();i++) { queue<int> q; for(int j=0;j<N;j++)flag1[j] = false; for(int j=0;j<N;j++)flag2[j] = false; for(int j=0;j<N;j++)vis[j] = false; for(int j=0;j<N;j++)vis2[j] = false; q.push(S[i]); flag1[S[i]] = true; while(q.empty() == false) { //cout<<"yeah"<<endl; int xx = q.front(); q.pop(); if(vis[xx] == true)continue; vis[xx] = true; for(int j=0;j<vv[xx].size();j++) { int to = vv[xx][j]; if(to >= L[i]) { flag1[to] = true; // vis[to] = true; q.push(to); } } } //cout<<"YEAH"<<endl; q.push(E[i]); flag2 [E[i]] = true; while(q.empty() == false) { int xx = q.front(); q.pop(); //cout<<xx<<endl; if(vis2[xx] == true)continue; vis2[xx] = true; for(int j=0;j<vv[xx].size();j++) { int to = vv[xx][j]; if(to <= R[i]) { flag2[to] = true; q.push(to); } } } for(int j=0;j<N;j++) { if(flag1[j] == true && flag2[j] == true && L[i] <= j && j <= R[i]) { ans.push_back(1); break; } } if(ans.size() < i+1)ans.push_back(0); } return ans; /*int Q = S.size(); std::vector<int> A(Q); for (int i = 0; i < Q; ++i) { A[i] = 0; } return A;*/ }

컴파일 시 표준 에러 (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:16:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for(int i=0;i<X.size();i++)
      |              ~^~~~~~~~~
werewolf.cpp:21:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i=0;i<S.size();i++)
      |              ~^~~~~~~~~
werewolf.cpp:37:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |    for(int j=0;j<vv[xx].size();j++)
      |                ~^~~~~~~~~~~~~~
werewolf.cpp:58:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |    for(int j=0;j<vv[xx].size();j++)
      |                ~^~~~~~~~~~~~~~
werewolf.cpp:76:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   76 |   if(ans.size() < i+1)ans.push_back(0);
      |      ~~~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...