Submission #435111

# Submission time Handle Problem Language Result Execution time Memory
435111 2021-06-23T03:09:14 Z Apiram Werewolf (IOI18_werewolf) C++14
0 / 100
172 ms 21500 KB
#include<bits/stdc++.h>
//#include "werewolf.h"
using namespace std;
vector<vector<int>>adj(10000);
bool ok;
vector<bool>visited(10000,false);
void dfs (int s,int bot,int l,int r,int e,bool changed){
	if (ok)return;
	if (s==e){
		ok=true;
		return;
	}
	visited[s]=true;
	for (auto x:adj[s]){
		if (!visited[x]){
			if (bot==0&&x>=r){
				dfs(x,bot,l,r,e,changed);
			}
			else if (bot==1&&x<=l){
				dfs(x,bot,l,r,e,changed);
			}
			else if (x>l&&x<r){
				if (!changed)
				dfs(x,bot^1,l,r,e,true);
				dfs(x,bot,l,r,e,changed);
			}
		}
	}
}
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<N;++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){
  	ok=false;
  	for (int i =0;i<10000;++i)visited[i]=false;
  	dfs(s[i],0,L[i]-1,R[i],E[i],false);
  	A[i]|=ok;
	}
  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:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |  for (int i  =0;i<E.size();++i){
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 172 ms 21500 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -