# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
990262 | wood | Werewolf (IOI18_werewolf) | C++17 | 865 ms | 524288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vi vector<int>
#define vp32 vector<p32>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MOD %1000000007
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T>
using Tree =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//never guess
//never debug without reviewing code
//never try adding ones or substracting them
//only step by step debug when necessay
vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
std::vector<int> S, std::vector<int> E,
std::vector<int> L, std::vector<int> R) {
vi adj[N];
vi res;
for(int i = 0; i<X.size(); i++){
adj[X[i]].pb(Y[i]);
adj[Y[i]].pb(X[i]);
}
for (size_t i = 0; i < S.size(); i++)
{
int done[N];
memset(done,0,sizeof done);
stack<int> st;
st.push(S[i]);
while(!st.empty()){
int x = st.top();
st.pop();
done[x] = 1;
for(int a : adj[x]){
if(done[a]||a<L[i]) continue;
st.push(a);
}
}
st.push(E[i]);
while(!st.empty()){
int x = st.top();
st.pop();
if(done[x]==1) goto yes;
for(int a : adj[x]){
if(done[a]==2||a>R[i]) continue;
st.push(a);
}
}
res.pb(0);
continue;
yes:
res.pb(1);
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |