Submission #771891

# Submission time Handle Problem Language Result Execution time Memory
771891 2023-07-03T11:26:13 Z alvingogo Werewolf (IOI18_werewolf) C++14
15 / 100
4000 ms 23088 KB
#include <bits/stdc++.h>
#include "werewolf.h"
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
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 q=s.size();
    vector<int> ans(q);
	int m=x.size();
	vector<vector<int> > f(n);
	for(int i=0;i<m;i++){
		f[x[i]].push_back(y[i]);
		f[y[i]].push_back(x[i]);
	}
    for(int i=0;i<q;i++){
        queue<int> q1;
        q1.push(s[i]);
        vector<int> vis(n),vis2(n);
        vis[s[i]]=1;
        while(q1.size()){
            auto h=q1.front();
            q1.pop();
            for(auto y:f[h]){
                if(y>=l[i] && !vis[y]){
                    vis[y]=1;
                    q1.push(y);
                }
            }
        }
        q1.push(e[i]);
        vis2[e[i]]=1;
        while(q1.size()){
            auto h=q1.front();
            q1.pop();
            for(auto y:f[h]){
                if(y<=r[i] && !vis2[y]){
                    vis2[y]=1;
                    q1.push(y);
                }
            }
        }
        for(int j=0;j<n;j++){
            if(vis[j]+vis2[j]==2){
                ans[i]=1;
            }
        }
    }
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 201 ms 724 KB Output is correct
11 Correct 113 ms 832 KB Output is correct
12 Correct 14 ms 736 KB Output is correct
13 Correct 213 ms 744 KB Output is correct
14 Correct 128 ms 728 KB Output is correct
15 Correct 172 ms 948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4078 ms 23088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 201 ms 724 KB Output is correct
11 Correct 113 ms 832 KB Output is correct
12 Correct 14 ms 736 KB Output is correct
13 Correct 213 ms 744 KB Output is correct
14 Correct 128 ms 728 KB Output is correct
15 Correct 172 ms 948 KB Output is correct
16 Execution timed out 4078 ms 23088 KB Time limit exceeded
17 Halted 0 ms 0 KB -