# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
413140 | schse | 늑대인간 (IOI18_werewolf) | C++14 | 4053 ms | 33184 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "werewolf.h"
#include <bits/stdc++.h>
#ifndef EVAL
#include "grader.cpp"
#endif
using namespace std;
struct node
{
bool human = false;
bool wolf = false;
vector<int> edges;
};
vector<node> g;
void humanfdfs(int n, int l)
{
if (n < l || g[n].human)
return;
g[n].human = true;
for (auto i : g[n].edges)
{
humanfdfs(i, l);
}
}
bool wolfdfs(int n, int r)
{
if (n > r || g[n].wolf)
return false;
g[n].wolf = true;
if (g[n].wolf && g[n].human)
return true;
for (auto i : g[n].edges)
{
if (wolfdfs(i, r))
return true;
}
return false;
}
std::vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
std::vector<int> S, std::vector<int> E,
std::vector<int> L, std::vector<int> R)
{
g.resize(N);
for (int i = 0; i < X.size(); i++)
{
g[X[i]].edges.push_back(Y[i]);
g[Y[i]].edges.push_back(X[i]);
}
vector<int> out;
for (int i = 0; i < S.size(); i++)
{
humanfdfs(S[i], L[i]);
out.push_back(wolfdfs(E[i], R[i]));
for (int e = 0; e < N; e++)
g[e].wolf = g[e].human = false;
}
return out;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |