Submission #580512

#TimeUsernameProblemLanguageResultExecution timeMemory
580512VanillaWerewolf (IOI18_werewolf)C++17
15 / 100
257 ms19668 KiB
#include <bits/stdc++.h> #include "werewolf.h" using namespace std; const int maxn = 3e3 + 2; vector <int> ad [maxn]; bitset <maxn> vis1, vis2; void dfs1 (int u, int l, int r) { vis1[u] = 1; for (int v: ad[u]) { if (v < l || vis1[v]) continue; dfs1(v, l, r); } } int dfs2 (int u, int l, int r) { vis2[u] = 1; bool b = (vis1[u] && u >= l && u <= r); for (int v: ad[u]) { if (v > r || vis2[v]) continue; b|=dfs2(v, l, r); } return b; } vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) { for (int i = 0; i < X.size(); i++){ ad[X[i]].push_back(Y[i]); ad[Y[i]].push_back(X[i]); } int Q = S.size(); vector<int> A(Q); for (int i = 0; i < Q; ++i) { vis1 = vis2 = 0; dfs1(S[i], L[i], R[i]); A[i] = dfs2(E[i], L[i], R[i]); } 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:29:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   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...