Submission #138817

# Submission time Handle Problem Language Result Execution time Memory
138817 2019-07-30T11:30:26 Z KalasLavas Werewolf (IOI18_werewolf) C++14
0 / 100
279 ms 50032 KB
#include "werewolf.h"
#include <bits/stdc++.h>
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
//*/
std::mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define y1 asjfkgasj
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define flsh '\n'<<flush
#define mp make_pair
#define mt make_tuple
#define sz size
#define pii pair<int,int>
#define pll pair<long long,long long>
#define vi vector<int>
#define vll vector<long long>
#define deb(x) cout<< #x <<'='<< x <<flsh;
#define iii int,int,int
#define ull unsigned long long
#define intt long long
#define ld long double
#define dd double
#define OK cout<<"OK\n"<<flsh;
#define setpre(x) fixed<<setprecision(x)
#define mmset(x,y) memset(x,y,sizeof(x))

vector<vector<int>>g;
vector<int>ans;
vector<int> check_validity(int n,vector<int> X,vector<int> Y,
                                vector<int> S,vector<int> E,
                                vector<int> L,vector<int> R)
{
	g.resize(n);
	for(int i=0;i<X.size();i++)
	{
		g[X[i]].pb(Y[i]);
		g[Y[i]].pb(X[i]);
	}

	for(int ii=0;ii<S.size();ii++)
	{
		int l=L[ii],r=R[ii];
		queue<int>q;
		char c[3001];
		mmset(c,0);
		q.push(S[ii]);
		c[S[ii]]=1;
		while(!q.empty())
		{
			int v=q.front();
			q.pop();
			if(v<l)
			{
				c[v]=1;
				for(int u : g[v])
					if(u<=r and !c[u])
					{
						c[u]=1;
						q.push(u);
					}
			}
			else if(r<v)
			{
				c[v]=2;
				for(int u : g[v])
					if(l<=u and !c[u])
					{
						c[u]=2;
						q.push(u);
					}
			}
			else
			{
				for(int u : g[v])
					if(!c[u])
					{
						if(c[v]!=2)
						{
							c[u]=1;
							q.push(u);
						}
						else if(l<=u and c[v]==2)
						{
							c[u]=2;
							q.push(u);
						}
					}
			}
		}
		if(c[E[ii]]) ans.pb(1);
		else ans.pb(0);
	//	cout<<bool(c[E[ii]])<<endl;
	}
	//exit(0);
	return ans;
}

Compilation message

werewolf.cpp:7:1: warning: "/*" within comment [-Wcomment]
 /*
  
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:47:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<X.size();i++)
              ~^~~~~~~~~
werewolf.cpp:53:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int ii=0;ii<S.size();ii++)
               ~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 279 ms 50032 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -