Submission #333592

# Submission time Handle Problem Language Result Execution time Memory
333592 2020-12-07T06:39:08 Z nicholask Werewolf (IOI18_werewolf) C++14
0 / 100
4000 ms 20756 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
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(),q=s.size();
	vector <int> g[n];
	for (int i=0; i<m; i++){
		g[x[i]].push_back(y[i]);
		g[y[i]].push_back(x[i]);
	}
	vector <int> res;
	for (int i=0; i<q; i++){
		bool visited[n];
		for (int j=0; j<n; j++) visited[i]=0;
		queue <int> q;
		if (s[i]>=l[i]){
			q.push(s[i]);
			visited[s[i]]=1;
		}
		while (!q.empty()){
			int t=q.front();
			q.pop();
			for (auto&j:g[t]){
				if (j>=l[i]&&!visited[j]){
					q.push(j);
					visited[j]=1;
				}
			}
		}
		for (int j=0; j<n; j++){
			if (!visited[j]) continue;
			bool vis[n];
			for (int k=0; k<n; i++) vis[k]=0;
			queue <int> u;
			if (j<=r[i]){
				u.push(j);
				vis[j]=1;
			}
			while (!u.empty()){
				int t=u.front();
				u.pop();
				if (t==e[i]){
					res.push_back(1);
					goto die;
				}
				for (auto&k:g[t]){
					if (k<=r[i]&&!vis[k]){
						u.push(k);
						visited[k]=1;
					}
				}
			}
		}
		res.push_back(0);
		die:;
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4030 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4030 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4043 ms 20756 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4030 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -