제출 #1024200

#제출 시각아이디문제언어결과실행 시간메모리
1024200ksu2009en늑대인간 (IOI18_werewolf)C++17
0 / 100
4062 ms35668 KiB
#include "werewolf.h" #include <iostream> #include <vector> #include <string> #include <math.h> #include <cmath> #include <iomanip> #include <cstdio> #include <algorithm> #include <numeric> #include <map> #include <set> #include <queue> #include <stack> #include <deque> #include <bitset> #include <cstring> #include <unordered_map> using namespace std; typedef int ll; vector<ll> d[200007]; bool used1[200007], used2[200007]; ll lim = 0; void dfs1(ll v){ if(v < lim) return; used1[v] = true; for(auto i: d[v]){ if(!used1[i] && i >= lim) dfs1(i); } } void dfs2(ll v){ if(v > lim) return; used2[v] = true; for(auto i: d[v]){ if(!used2[i] && i <= lim) dfs2(i); } } 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) { ll q = l.size(); for(int i = 0; i < q; i++) s[i]++, e[i]++; for(int i = 0; i < x.size(); i++){ d[x[i]].push_back(y[i]); d[y[i]].push_back(x[i]); } vector<int> ans(q); for(int i = 0; i < q; i++){ ll lim = l[i]; dfs1(s[i]); lim = r[i]; dfs2(e[i]); int res = 0; for(int j = 1; j <= n; j++){ if(used1[j] && used2[j]){ res = 1; } used1[j] = used2[j] = 0; } ans.push_back(res); } 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:60:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |     for(int i = 0; i < x.size(); i++){
      |                    ~~^~~~~~~~~~
werewolf.cpp:68:12: warning: variable 'lim' set but not used [-Wunused-but-set-variable]
   68 |         ll lim = l[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...