제출 #141101

#제출 시각아이디문제언어결과실행 시간메모리
141101Minnakhmetov늑대인간 (IOI18_werewolf)C++14
0 / 100
201 ms20972 KiB
#include "werewolf.h" using namespace std; #define ll long long const int N = 205; int w[N]; int findSet(int v) { return w[v] < 0 ? v : w[v] = findSet(w[v]); } void connect(int a, int b) { a = findSet(a); b = findSet(b); if (a != b) { if (w[a] > w[b]) swap(a, b); w[a] += w[b]; w[b] = a; } } vector<int> check_validity(int n, vector<int> x, vector<int> y, vector<int> s, vector<int> e, vector<int> l, vector<int> r) { int q = s.size(), m = x.size(); vector<int> ans(q); for (int i = 0; i < m; i++) { if (x[i] > y[i]) { swap(x[i], y[i]); } } for (int i = 0; i < q; i++) { fill(w, w + n + n, -1); for (int j = 0; j < m; j++) { if (x[j] >= l[i]) connect(x[j], y[j]); if (y[j] <= r[i]) connect(x[j] + n, y[j] + n); } for (int j = l[i]; j <= r[i]; j++) connect(j, j + n); ans[i] = (findSet(s[i]) == findSet(e[i] + n)); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...