Submission #604385

# Submission time Handle Problem Language Result Execution time Memory
604385 2022-07-25T05:23:56 Z amunduzbaev Werewolf (IOI18_werewolf) C++17
15 / 100
4000 ms 30328 KB
#include "werewolf.h"
#include "bits/stdc++.h"
using namespace std;
#ifndef EVAL
#include "grader.cpp"
#endif

#define ar array
typedef long long ll;

const int N = 2e5 + 5;
vector<int> edges[N];
int c[N];

vector<int> check_validity(int n, vector<int> X, vector<int> Y, vector<int> S, vector<int> E, vector<int> L, vector<int> R) {
	int m = X.size();
	for(int i=0;i<m;i++){
		edges[X[i]].push_back(Y[i]);
		edges[Y[i]].push_back(X[i]);
	}
	
	int q = S.size();
	vector<int> a(q);
	for(int i=0;i<q;i++){
		int s = S[i], e = E[i], vl = L[i], vr = R[i];
		for(int i=0;i<n;i++){
			if(i < vl) c[i] = 0;
			if(vr < i) c[i] = 1;
			if(vl <= i && i <= vr) c[i] = 2;
		}
		
		vector<int> used(n);
		int t = 1;
		function<void(int)> dfs = [&](int u){
			used[u] = 1;
			for(auto x : edges[u]){
				if(used[x]) continue;
				if(c[x] == t || c[x] == 2){
					dfs(x);
				}
			}
		};
		
		dfs(s);
		vector<int> tmp = used; fill(used.begin(), used.end(), 0);
		t = 0;
		dfs(e);
		for(int j=0;j<n;j++){
			if(used[j] && tmp[j]){
				a[i] = 1;
			}
		}
	}
	
	return a;
}

/*

6 6 3
5 1
1 2
1 3
3 4
3 0
5 2
4 2 1 2
4 2 2 2
5 4 3 4

*/
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5000 KB Output is correct
7 Correct 3 ms 5008 KB Output is correct
8 Correct 4 ms 4948 KB Output is correct
9 Correct 4 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5000 KB Output is correct
7 Correct 3 ms 5008 KB Output is correct
8 Correct 4 ms 4948 KB Output is correct
9 Correct 4 ms 4948 KB Output is correct
10 Correct 328 ms 5420 KB Output is correct
11 Correct 212 ms 5364 KB Output is correct
12 Correct 34 ms 5544 KB Output is correct
13 Correct 344 ms 5420 KB Output is correct
14 Correct 241 ms 5332 KB Output is correct
15 Correct 262 ms 5580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4035 ms 30328 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5000 KB Output is correct
7 Correct 3 ms 5008 KB Output is correct
8 Correct 4 ms 4948 KB Output is correct
9 Correct 4 ms 4948 KB Output is correct
10 Correct 328 ms 5420 KB Output is correct
11 Correct 212 ms 5364 KB Output is correct
12 Correct 34 ms 5544 KB Output is correct
13 Correct 344 ms 5420 KB Output is correct
14 Correct 241 ms 5332 KB Output is correct
15 Correct 262 ms 5580 KB Output is correct
16 Execution timed out 4035 ms 30328 KB Time limit exceeded
17 Halted 0 ms 0 KB -