답안 #768681

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
768681 2023-06-28T11:38:17 Z Baytoro 늑대인간 (IOI18_werewolf) C++17
15 / 100
4000 ms 40184 KB
#include "werewolf.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=2e5+5;
vector<int> g[N];
int col[N];
vector<int> used;
void dfs(int x, int c, vector<int> &used){
	used[x]=1;
	//cout<<x<<' '<<c<<' '<<col[x]<<endl;
	for(auto it: g[x]){
		if(used[it]) continue;
		if(c==1 && col[it]<=1) 
			dfs(it,c,used);
		if(c==2 && col[it]>=1) 
			dfs(it,c,used);
	}
}
vector<int> check_validity(int n, vector<int> X, vector<int> Y,
                                vector<int> S, vector<int> E,
                                vector<int> L, vector<int> R) {
	int m=X.size(),q=S.size();
	for(int i=0;i<m;i++){
		g[X[i]].pb(Y[i]);
		g[Y[i]].pb(X[i]);
	}
	//Subtask 2
	vector<int> ans(q);
	for(int i=0;i<q;i++){
		if(E[i]>R[i] || S[i]<L[i]) continue;
		for(int j=0;j<n;j++){
			if(j<L[i]) col[j]=2;
			else if(j<=R[i]) col[j]=1;
			else col[j]=0;
		}
		vector<int> a(n),b(n);
		dfs(S[i],1,a);
		dfs(E[i],2,b);
		for(int j=L[i];j<=R[i];j++)
			if(a[j] && b[j])
				ans[i]=1;
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5012 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 5004 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 3 ms 5004 KB Output is correct
8 Correct 3 ms 4948 KB Output is correct
9 Correct 3 ms 5000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5012 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 5004 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 3 ms 5004 KB Output is correct
8 Correct 3 ms 4948 KB Output is correct
9 Correct 3 ms 5000 KB Output is correct
10 Correct 230 ms 5408 KB Output is correct
11 Correct 130 ms 5364 KB Output is correct
12 Correct 27 ms 5508 KB Output is correct
13 Correct 261 ms 5396 KB Output is correct
14 Correct 159 ms 5380 KB Output is correct
15 Correct 208 ms 5572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4033 ms 40184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5012 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 3 ms 5004 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 2 ms 4948 KB Output is correct
7 Correct 3 ms 5004 KB Output is correct
8 Correct 3 ms 4948 KB Output is correct
9 Correct 3 ms 5000 KB Output is correct
10 Correct 230 ms 5408 KB Output is correct
11 Correct 130 ms 5364 KB Output is correct
12 Correct 27 ms 5508 KB Output is correct
13 Correct 261 ms 5396 KB Output is correct
14 Correct 159 ms 5380 KB Output is correct
15 Correct 208 ms 5572 KB Output is correct
16 Execution timed out 4033 ms 40184 KB Time limit exceeded
17 Halted 0 ms 0 KB -