# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
806763 | Benmath | 늑대인간 (IOI18_werewolf) | C++14 | 4037 ms | 25720 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <cstdlib>
#include <vector>
#include<bits/stdc++.h>
#include "werewolf.h"
namespace {
int read_int() {
int x;
if (scanf("%d", &x) != 1) {
fprintf(stderr, "Error while reading input\n");
exit(1);
}
return x;
}
} // namespace
using namespace std;
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) {
int q = S.size();
std::vector<int> A(q);
vector<int>adjl[n+1];
int m=X.size();
for(int i=0;i<m;i++){
adjl[X[i]].push_back(Y[i]);
adjl[Y[i]].push_back(X[i]);
}
for (int i = 0; i < q; ++i) {
A[i] = 0;
int x=S[i];
int y=E[i];
int l=L[i];
int r=R[i];
int wolf[n+1];
int human[n+1];
for(int j=0;j<n;j++){
wolf[j]=0;
human[j]=0;
}
queue<int>q;
q.push(x);
human[x]++;
while(!q.empty()){
int a=q.front();
q.pop();
for(int j=0;j<adjl[a].size();j++){
if(human[adjl[a][j]]==0 and adjl[a][j]>=l){
human[adjl[a][j]]++;
q.push(adjl[a][j]);
}
}
}
q.push(y);
wolf[y]++;
while(!q.empty()){
int a=q.front();
q.pop();
for(int j=0;j<adjl[a].size();j++){
if(wolf[adjl[a][j]]==0 and adjl[a][j]<=r){
wolf[adjl[a][j]]++;
q.push(adjl[a][j]);
}
}
}
for(int j=0;j<n;j++){
if(human[j]>0 and wolf[j]>0){
A[i]++;
}
}
A[i]=min(A[i],1);
}
return A;
}
컴파일 시 표준 에러 (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... |