Submission #601525

# Submission time Handle Problem Language Result Execution time Memory
601525 2022-07-22T07:06:40 Z jairRS Werewolf (IOI18_werewolf) C++17
0 / 100
4000 ms 21392 KB
#include "werewolf.h"
#include "bits/stdc++.h"
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

const int INF = 1e9;

vi check_validity(int N, vi X, vi Y, vi S, vi E, vi L, vi R)
{
	vvi adj = vvi(N);
	for (int i = 0; i < N; i++)
	{
		adj[X[i]].push_back(Y[i]);
		adj[Y[i]].push_back(X[i]);
	}

	int Q = S.size();
	vi ans(Q, 0);
	for (int i = 0; i < Q; i++)
	{
		vector<bool> visited(N, false);
		queue<int> q;
		q.push(S[i]);
		visited[S[i]] = true;

		while (!q.empty())
		{
			int cur = q.front();
			q.pop();
			if (cur < L[i])
				continue;

			vector<bool> visitedWOLF(N, false);
			queue<int> qWOLF;
			qWOLF.push(cur);
			visitedWOLF[cur] = true;

			while (!qWOLF.empty())
			{
				int curWOLF = qWOLF.front();
				qWOLF.pop();
				if (curWOLF > R[i])
					continue;

				if (curWOLF == E[i])
					ans[i] = true;

				for (int a : adj[curWOLF])
				{
					if (visitedWOLF[a])
						continue;
					qWOLF.push(a);
					visitedWOLF[a] = true;
				}
			}

			for (int a : adj[cur])
			{
				if (visited[a])
					continue;
				q.push(a);
				visited[a] = true;
			}
		}
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4053 ms 21392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -