Submission #742079

#TimeUsernameProblemLanguageResultExecution timeMemory
742079Ronin13Werewolf (IOI18_werewolf)C++14
15 / 100
583 ms24232 KiB
#include "werewolf.h" #include <bits/stdc++.h> #define ll long long #define f first #define s second #define pii pair<int,int> #define pll pair<ll, ll> #define pb push_back #define epb emplace_back #define ull unsigned ll using namespace std; const int nmax = 200001; /*6 6 3 5 1 1 2 1 3 3 4 3 0 5 2 4 2 1 2 4 2 2 2 5 4 3 4 */ vector <int> p(nmax), sz(nmax); void make_set(int v){ p[v]= v; sz[v] = 1; } int find_set(int v){ return p[v] == v ? v : p[v] = find_set(p[v]); } void union_sets(int a, int b){ a = find_set(a); b = find_set(b); if(a == b) return; if(sz[a] < sz[b]) swap(a, b); p[b] = a; sz[a] += sz[b]; } 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) { int Q = S.size(); int n = N; std::vector<int> A(Q); for (int i = 0; i < Q; ++i) { for(int j = 0; j < N; j++){ make_set(j), make_set(n + j); } for(int j = 0; j < X.size(); j++){ int u = X[j], v = Y[j]; if(u <= R[i] && v <= R[i]) union_sets(u, v); if(u >= L[i] && v >= L[i]) union_sets(u + n, v + n); } for(int x = L[i]; x <= R[i]; x++){ if(find_set(x) == find_set(E[i])){ if(find_set(x + n) == find_set(S[i] + n)) A[i] = 1; } } } return A; }

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:58:26: 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 < X.size(); j++){
      |                        ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...