답안 #602366

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
602366 2022-07-23T00:59:27 Z jairRS 늑대인간 (IOI18_werewolf) C++17
7 / 100
4000 ms 21384 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 < (int)X.size(); 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 312 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 5 ms 212 KB Output is correct
6 Correct 6 ms 308 KB Output is correct
7 Correct 6 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 312 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 5 ms 212 KB Output is correct
6 Correct 6 ms 308 KB Output is correct
7 Correct 6 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Execution timed out 4045 ms 620 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4073 ms 21384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 312 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 5 ms 212 KB Output is correct
6 Correct 6 ms 308 KB Output is correct
7 Correct 6 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 3 ms 212 KB Output is correct
10 Execution timed out 4045 ms 620 KB Time limit exceeded
11 Halted 0 ms 0 KB -