답안 #333589

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333589 2020-12-07T06:04:14 Z nicholask 늑대인간 (IOI18_werewolf) C++14
0 / 100
4000 ms 22792 KB
#include "werewolf.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> g[200000];
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]].push_back(y[i]);
		g[y[i]].push_back(x[i]);
	}
	vector <int> ans;
	for (int i=0; i<q; i++){
		bool visited[n];
		for (int j=0; j<n; j++) visited[j]=0;
		vector <int> cango;
		queue <int> q;
		if (s[i]>=l[i]){
			q.push(s[i]);
			visited[s[i]]=1;
			cango.push_back(s[i]);
		}
		while (!q.empty()){
			int t=q.front();
			q.pop();
			for (auto&j:g[t]){
				if (!visited[j]&&j>=l[i]){
					q.push(j);
					cango.push_back(j);
					visited[j]=1;
				}
			}
		}
		for (auto&j:cango){
			//from j to e[i]
			for (int k=0; k<n; k++) visited[i]=0;
			queue <int> q;
			if (j<=r[i]){
				q.push(j);
				visited[j]=1;
			}
			while (!q.empty()){
				int t=q.front();
				q.pop();
				if (t==e[i]){
					ans.push_back(1);
					goto die;
				}
				for (auto&k:g[t]){
					if (!visited[k]&&k<=r[i]){
						q.push(k);
						visited[k]=1;
					}
				}
			}
		}
		ans.push_back(0);
		die:;
		cango.clear();
		while (!q.empty()) q.pop();
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 4 ms 4972 KB Output is correct
3 Runtime error 10 ms 9964 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 4 ms 4972 KB Output is correct
3 Runtime error 10 ms 9964 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4050 ms 22792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 4 ms 4972 KB Output is correct
3 Runtime error 10 ms 9964 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -