답안 #435173

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
435173 2021-06-23T04:49:24 Z Apiram 늑대인간 (IOI18_werewolf) C++14
7 / 100
4000 ms 21496 KB
#include<bits/stdc++.h>
#include "werewolf.h"
using namespace std;
vector<vector<int>>adj(2e5 + 5);
bool ok;
vector<bool>visited(2e5 + 5,false);
void dfs (int s,int par,int l,int r,int e){
	if (ok)return;
	if (s==e){
		ok=true;
		return;
	}
	visited[s]=true;
	for (auto x:adj[s]){
		if (x>=l&&x<=r&&!visited[x]){
			dfs(x,s,l,r,e);
		}
	}
}
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) {
  vector<int>A(E.size());
  for (int i  =0;i<X.size();++i){
  	adj[X[i]].push_back(Y[i]);
  	adj[Y[i]].push_back(X[i]);
  }
  //0 - human
  //1 - wolf
	for (int i  =0;i<E.size();++i){
  	for (int j =L[i];j<=R[i];++j){
  	for (int i =0;i<=N;++i){
  		visited[i]=false;
  	}
  	ok=false;
  	dfs(j,-1,0,R[i],E[i]);
  	A[i]=ok;
  	ok=false;
  	for (int i =0;i<=N;++i){
  		visited[i]=false;
  	}
  	dfs(s[i],-1,L[i],N-1,j);
  	A[i]&=ok;
  	if (A[i])break;
  	}
	}
  return A;
}

Compilation message

werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:24:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   for (int i  =0;i<X.size();++i){
      |                  ~^~~~~~~~~
werewolf.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for (int i  =0;i<E.size();++i){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 5 ms 4940 KB Output is correct
3 Correct 4 ms 5060 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 5 ms 4940 KB Output is correct
6 Correct 6 ms 4940 KB Output is correct
7 Correct 5 ms 4940 KB Output is correct
8 Correct 7 ms 4940 KB Output is correct
9 Correct 5 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 5 ms 4940 KB Output is correct
3 Correct 4 ms 5060 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 5 ms 4940 KB Output is correct
6 Correct 6 ms 4940 KB Output is correct
7 Correct 5 ms 4940 KB Output is correct
8 Correct 7 ms 4940 KB Output is correct
9 Correct 5 ms 4940 KB Output is correct
10 Execution timed out 4091 ms 5196 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4100 ms 21496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 5 ms 4940 KB Output is correct
3 Correct 4 ms 5060 KB Output is correct
4 Correct 4 ms 4992 KB Output is correct
5 Correct 5 ms 4940 KB Output is correct
6 Correct 6 ms 4940 KB Output is correct
7 Correct 5 ms 4940 KB Output is correct
8 Correct 7 ms 4940 KB Output is correct
9 Correct 5 ms 4940 KB Output is correct
10 Execution timed out 4091 ms 5196 KB Time limit exceeded
11 Halted 0 ms 0 KB -