Submission #406242

# Submission time Handle Problem Language Result Execution time Memory
406242 2021-05-17T09:49:42 Z Antekb Werewolf (IOI18_werewolf) C++14
15 / 100
247 ms 24868 KB
#include "werewolf.h"
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
using namespace std;
typedef vector<int> vi;
const int N=1e5+5;
vi E[N];
int vis[N];
int dfs(int v, int l, int r, int col){
	//cout<<v<<" "<<l<<" "<<r<<" "<<col<<"\n";
	//assert(l<=v && v<=r);
	if(vis[v]==(col-1))return 1;
	//cout<<"x";
	vis[v]=col;
	int ans=0;
	for(int u:E[v]){
		//cout<<u<<"\n";
		if(vis[u]!=col && l<=u && u<=r){
			ans|=dfs(u, l, r, col);
		}
	}
	return ans;
}
std::vector<int> check_validity(int n, vi X, vi Y,
                                vi S, vi T,
                                vi L, vi R) {
    int m=X.size();
	for(int i=0; i<m; i++){
		E[X[i]].pb(Y[i]);
		E[Y[i]].pb(X[i]);
	}
	int q = S.size();
	std::vector<int> A(q);
  	for (int i = 0; i < q; ++i){
  		//cout<<"a\n";
  		dfs(S[i], L[i], n-1, 2);
  		//cout<<"b\n";
		A[i] = dfs(T[i], 0, R[i], 3);
		for(int j=0; j<n; j++)vis[j]=0;
	}
	return A;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2648 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Correct 2 ms 2648 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2652 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 2 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2648 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Correct 2 ms 2648 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2652 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 2 ms 2648 KB Output is correct
10 Correct 214 ms 3044 KB Output is correct
11 Correct 111 ms 2988 KB Output is correct
12 Correct 17 ms 3148 KB Output is correct
13 Correct 247 ms 3040 KB Output is correct
14 Correct 191 ms 3004 KB Output is correct
15 Correct 224 ms 3240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 179 ms 24868 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2648 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Correct 2 ms 2648 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2652 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 2 ms 2648 KB Output is correct
10 Correct 214 ms 3044 KB Output is correct
11 Correct 111 ms 2988 KB Output is correct
12 Correct 17 ms 3148 KB Output is correct
13 Correct 247 ms 3040 KB Output is correct
14 Correct 191 ms 3004 KB Output is correct
15 Correct 224 ms 3240 KB Output is correct
16 Runtime error 179 ms 24868 KB Execution killed with signal 11
17 Halted 0 ms 0 KB -