Submission #1043009

# Submission time Handle Problem Language Result Execution time Memory
1043009 2024-08-03T17:43:07 Z XJP12 Werewolf (IOI18_werewolf) C++14
15 / 100
4000 ms 39296 KB
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi ;
vvi g;
bitset<200005> vis;
bitset<200005> vis1;
bool ban=false;
void dfs2(int u, int l){
	if(u>l) return;
	vis1[u]=true;
	if(vis[u]==true && vis1[u]==true){
		ban=true;
	}
	for(auto v: g[u]){
		if(!vis1[v]){
			dfs2(v,l);
		}
	}
}
void dfs1(int u, int l){
	if(u<l) return;
	vis[u]=true;
	for(auto v: g[u]){
		if(!vis[v]){
			dfs1(v,l);
		}
	}
}
vi check_validity(int n, vi x, vi y, vi s, vi e, vi l, vi r){
	int m = (int)x.size();
	int q = (int)e.size();
	vi ans(q,0);
	g.resize(n, vi());
	for(int i=0; i<m; i++){
		g[x[i]].push_back(y[i]);
		g[y[i]].push_back(x[i]);
	}
	for(int i=0; i<q; i++){
		vis.reset();
		vis1.reset();
		ban=false;
		dfs1(s[i], l[i]);
		dfs2(e[i], r[i]);
		if(ban){
			ans[i]=1;
		}
	}
	return ans;

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 448 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 448 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 161 ms 856 KB Output is correct
11 Correct 69 ms 896 KB Output is correct
12 Correct 9 ms 1036 KB Output is correct
13 Correct 170 ms 928 KB Output is correct
14 Correct 65 ms 884 KB Output is correct
15 Correct 153 ms 1080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3995 ms 39252 KB Output is correct
2 Execution timed out 4082 ms 39296 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 448 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 436 KB Output is correct
9 Correct 1 ms 604 KB Output is correct
10 Correct 161 ms 856 KB Output is correct
11 Correct 69 ms 896 KB Output is correct
12 Correct 9 ms 1036 KB Output is correct
13 Correct 170 ms 928 KB Output is correct
14 Correct 65 ms 884 KB Output is correct
15 Correct 153 ms 1080 KB Output is correct
16 Correct 3995 ms 39252 KB Output is correct
17 Execution timed out 4082 ms 39296 KB Time limit exceeded
18 Halted 0 ms 0 KB -