Submission #1024203

#TimeUsernameProblemLanguageResultExecution timeMemory
1024203ksu2009enWerewolf (IOI18_werewolf)C++17
15 / 100
4040 ms26484 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 < x.size(); i++){ d[x[i]].push_back(y[i]); d[y[i]].push_back(x[i]); } vector<int> ans; for(int i = 0; i < q; i++){ lim = l[i]; dfs1(s[i]); lim = r[i]; dfs2(e[i]); int res = 0; for(int j = 0; j < n; j++){ if(used1[j] && used2[j]){ res = 1; } used1[j] = used2[j] = 0; } ans.push_back(res); } return ans; } /* 6 6 3 0 3 3 1 3 4 1 2 2 5 1 5 4 2 1 2 4 2 2 2 5 4 3 4 */ /* 6 6 1 0 3 3 1 3 4 1 2 2 5 1 5 4 2 1 2 4 2 2 2 5 4 3 4 */

Compilation message (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:57:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for(int i = 0; i < x.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...