제출 #1015280

#제출 시각아이디문제언어결과실행 시간메모리
1015280mindiyak늑대인간 (IOI18_werewolf)C++14
15 / 100
4057 ms32024 KiB
#include "werewolf.h" #include <bits/stdc++.h> #include <string> #include <iostream> #include <cmath> #include <numeric> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int, int> pi; typedef pair<int, int> pl; typedef pair<ld, ld> pd; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<vector<int>> vvi; typedef vector<ld> vd; typedef vector<long> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; #define FOR(i, a, b) for (int i = a; i < (b); i++) #define F0R(i, a) for (int i = 0; i < (a); i++) #define FORd(i, a, b) for (int i = (b)-1; i >= a; i--) #define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--) #define trav(a, x) for (auto &a : x) #define uid(a, b) uniform_int_distribution<int>(a, b)(rng) #define len(x) (int)(x).size() #define mp make_pair #define pb push_back #define F first #define nl endl #define S second #define lb lower_bound #define ub upper_bound #define aint(x) x.begin(), x.end() #define raint(x) x.rbegin(), x.rend() #define ins insert const int MOD = 1000000007; int M,Q,N; vvi paths; vi check_validity(int n, vi X, vi Y, vi S, vi E ,vi L, vi R) { N = n;M = X.size(); Q = L.size(); vi ans(Q); paths = vvi(n,vi()); FOR(i,0,M){ paths[X[i]].pb(Y[i]); paths[Y[i]].pb(X[i]); } FOR(i,0,Q){ vi w(N,0),h(N,0); queue<int> q; q.push(S[i]); while(!q.empty()){ int a = q.front();q.pop(); if(h[a]||a<L[i])continue; h[a] = 1; for(int b:paths[a])q.push(b); } q = queue<int>(); q.push(E[i]); while(!q.empty()){ int a = q.front();q.pop(); if(w[a]||a>R[i])continue; w[a] = 1; for(int b:paths[a])q.push(b); } FOR(j,0,N){ if(ans[i])break; ans[i] = w[j] && h[j]; } } 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...