Submission #1018232

#TimeUsernameProblemLanguageResultExecution timeMemory
1018232vjudge1Werewolf (IOI18_werewolf)C++17
15 / 100
4014 ms33104 KiB
#include "werewolf.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector <ll>; using vi = vector <int>; const ll MAXN = 2E5+16; vll adj[MAXN]; ll vis[MAXN+MAXN]; ll timer = 1; vi check_validity (int n, vi us, vi vs, vi s, vi e, vi l, vi r) { ll Q = s.size(); for (ll i = 0; i < us.size(); i++) { adj[us[i]].push_back(vs[i]); adj[vs[i]].push_back(us[i]); } vi ans(Q); for (ll qid = 0; qid < Q; qid++) { queue <ll> q; q.push(s[qid]); timer++; while (q.size()) { ll u = q.front(); q.pop(); if (vis[u] == timer) continue; vis[u] = timer; ll uo = u%MAXN; ll lvl = u/MAXN; if (l[qid] <= uo && uo <= r[qid] && lvl == 0) { q.push(uo+MAXN); } for (ll v : adj[uo]) { if (lvl == 0 && v < l[qid]) continue; if (lvl == 1 && v > r[qid]) continue; q.push(v+MAXN*lvl); } } ans[qid] = (vis[e[qid]+MAXN] == timer); } return ans; }

Compilation message (stderr)

werewolf.cpp: In function 'vi check_validity(int, vi, vi, vi, vi, vi, vi)':
werewolf.cpp:15:22: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (ll i = 0; i < us.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...