Submission #763175

#TimeUsernameProblemLanguageResultExecution timeMemory
763175t6twotwoWerewolf (IOI18_werewolf)C++17
15 / 100
4050 ms30308 KiB
#include "werewolf.h" #include <bits/stdc++.h> using namespace std; vector<int> check_validity(int N, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) { vector<vector<int>> adj(N); for (int i = 0; i < X.size(); i++) { adj[X[i]].push_back(Y[i]); adj[Y[i]].push_back(X[i]); } int Q = S.size(); vector<int> ans(Q); for (int i = 0; i < Q; i++) { bool vis[N][2]{}; vis[S[i]][0] = 1; queue<pair<int, int>> q; q.emplace(S[i], 0); while (!q.empty()) { auto [x, z] = q.front(); q.pop(); if (z == 0 && x <= R[i] && !vis[x][1]) { vis[x][1] = 1; q.emplace(x, 1); } for (int y : adj[x]) { if (z == 0) { if (y >= L[i] && !vis[y][0]) { vis[y][0] = 1; q.emplace(y, 0); } } else { if (y <= R[i] && !vis[y][1]) { vis[y][1] = 1; q.emplace(y, 1); } } } } ans[i] = vis[E[i]][1]; } return ans; }

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:6:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |     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...