Submission #114094

# Submission time Handle Problem Language Result Execution time Memory
114094 2019-05-30T07:38:44 Z antimirage Werewolf (IOI18_werewolf) C++14
15 / 100
307 ms 49676 KB
#include "werewolf.h"
//#include "grader.cpp"
#include <bits/stdc++.h>

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define all(s) s.begin(), s.end()

using namespace std;

vector < vector <int> > g;

const int N = 3005;

int n, m, u[2][N];

void dfs (int v, int type, int l, int r)
{
	u[type][v] = 1;
	
	for (auto to : g[v])
	{
		if (u[type][to] || to < l || to > r) continue;
		
		dfs(to, type, l, r);	
	}
}

vector<int> check_validity(int N, vector<int> x, vector<int> y, vector<int> s, vector<int> e, vector<int> l, vector<int> r) 
{
	n = N;
	m = x.size();
	g.resize(n + 1);
	
	for (int i = 0; i < m; i++)
		g[ x[i] ].pb( y[i] ),
		g[ y[i] ].pb( x[i] );
	
	int q = s.size();
	
	vector <int> ans;
	
	for (int i = 0; i < q; i++)
	{
		memset(u, 0, sizeof(u));
		
		dfs(s[i], 0, l[i], n - 1);
		dfs(e[i], 1, 0, r[i]);
		
		bool fl = 0;
		
		for (int j = 0; j < n; j++){
		
			if (u[0][j] && u[1][j])
				fl = 1;
		}
		ans.pb(fl);
	}
	return ans;
}

# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 280 ms 808 KB Output is correct
11 Correct 174 ms 808 KB Output is correct
12 Correct 23 ms 1024 KB Output is correct
13 Correct 307 ms 988 KB Output is correct
14 Correct 205 ms 768 KB Output is correct
15 Correct 263 ms 988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 242 ms 49676 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 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 3 ms 384 KB Output is correct
10 Correct 280 ms 808 KB Output is correct
11 Correct 174 ms 808 KB Output is correct
12 Correct 23 ms 1024 KB Output is correct
13 Correct 307 ms 988 KB Output is correct
14 Correct 205 ms 768 KB Output is correct
15 Correct 263 ms 988 KB Output is correct
16 Runtime error 242 ms 49676 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -