Submission #1105142

# Submission time Handle Problem Language Result Execution time Memory
1105142 2024-10-25T14:59:18 Z thelegendary08 Werewolf (IOI18_werewolf) C++14
15 / 100
4000 ms 29888 KB
#include "werewolf.h"
#include<bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i<n; i++)
#define pb push_back
using namespace std;
std::vector<int> check_validity(int N, std::vector<int> X, std::vector<int> Y,
                                std::vector<int> S, std::vector<int> E,
                                std::vector<int> L, std::vector<int> R) {
  int Q = S.size();
  int m = X.size();
  vector<int>adj[N];
  f0r(i, m){
  	adj[X[i]].pb(Y[i]);
  	adj[Y[i]].pb(X[i]);
  }
  vector<int>ans(Q);
  f0r(t, Q){
  	int s = S[t];
  	int e = E[t];
  	int l = L[t];
  	int r = R[t];
  	vector<bool>vis(N, 0);
  	vector<bool>wis(N, 0);
  	
  	queue<int>q;
  	if(s >= l){
  		vis[s] = 1;
  		q.push(s);
  	}
  	while(!q.empty()){
  		int node = q.front();
  		q.pop();
  		for(auto u : adj[node]){
  			if(vis[u])continue;
  			if(u < l)continue;
  			vis[u] = 1;
  			q.push(u);
  		}
  	}
  	
  	if(e <= r){
  		wis[e] = 1;
  		q.push(e);
  	}
  	while(!q.empty()){
  		int node = q.front();
  		q.pop();
  		for(auto u : adj[node]){
  			if(wis[u])continue;
  			if(u > r)continue;
  			wis[u] = 1;
  			q.push(u);
  		}
  	}
  	int a = 0;
  	f0r(i,N){
  		if(vis[i] && wis[i])a = 1;
  	}
  	ans[t] = a;
  }
  
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 592 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 592 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 174 ms 860 KB Output is correct
11 Correct 89 ms 848 KB Output is correct
12 Correct 18 ms 848 KB Output is correct
13 Correct 201 ms 860 KB Output is correct
14 Correct 106 ms 856 KB Output is correct
15 Correct 172 ms 964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 4033 ms 29888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 592 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 174 ms 860 KB Output is correct
11 Correct 89 ms 848 KB Output is correct
12 Correct 18 ms 848 KB Output is correct
13 Correct 201 ms 860 KB Output is correct
14 Correct 106 ms 856 KB Output is correct
15 Correct 172 ms 964 KB Output is correct
16 Execution timed out 4033 ms 29888 KB Time limit exceeded
17 Halted 0 ms 0 KB -