답안 #333603

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333603 2020-12-07T07:24:34 Z nicholask 늑대인간 (IOI18_werewolf) C++14
15 / 100
4000 ms 23788 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
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();
	vector <int> g[n];
	for (int i=0; i<m; i++){
		g[x[i]].push_back(y[i]);
		g[y[i]].push_back(x[i]);
	}
	vector <int> res;
	for (int i=0; i<q; i++){
		bool visited[n];
		for (int j=0; j<n; j++) visited[j]=0;
		queue <int> q;
		if (s[i]>=l[i]){
			q.push(s[i]);
			visited[s[i]]=1;
		}
		while (!q.empty()){
			int t=q.front();
			q.pop();
			for (auto&j:g[t]){
				if (j>=l[i]&&!visited[j]){
					q.push(j);
					visited[j]=1;
				}
			}
		}
		bool visited1[n];
		for (int j=0; j<n; j++) visited1[j]=0;
		if (e[i]<=r[i]){
			q.push(e[i]);
			visited1[e[i]]=1;
		}
		while (!q.empty()){
			int t=q.front();
			q.pop();
			for (auto&j:g[t]){
				if (j<=r[i]&&!visited1[j]){
					q.push(j);
					visited1[j]=1;
				}
			}
		}
		bool can=0;
		for (int j=0; j<n; j++){
			if (visited[j]&&visited1[j]){
				can=1;
				break;
			}
		}
		res.push_back(can);
	}
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 279 ms 748 KB Output is correct
11 Correct 166 ms 876 KB Output is correct
12 Correct 32 ms 748 KB Output is correct
13 Correct 302 ms 748 KB Output is correct
14 Correct 200 ms 876 KB Output is correct
15 Correct 245 ms 876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4058 ms 23788 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 279 ms 748 KB Output is correct
11 Correct 166 ms 876 KB Output is correct
12 Correct 32 ms 748 KB Output is correct
13 Correct 302 ms 748 KB Output is correct
14 Correct 200 ms 876 KB Output is correct
15 Correct 245 ms 876 KB Output is correct
16 Execution timed out 4058 ms 23788 KB Time limit exceeded
17 Halted 0 ms 0 KB -