Submission #1111541

# Submission time Handle Problem Language Result Execution time Memory
1111541 2024-11-12T09:24:15 Z epicci23 Werewolf (IOI18_werewolf) C++17
15 / 100
206 ms 27976 KB
#include "bits/stdc++.h"
#include "werewolf.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;

const int N = 3005;
vector<int> v[N];
vector<int> Hvis,Wvis;

void dfs_h(int c,int l){
  if(Hvis[c]) return;
  Hvis[c]=1;
  for(int x:v[c]) if(x>=l) dfs_h(x,l);
}

void dfs_w(int c,int r){
  if(Wvis[c]) return;
  Wvis[c]=1;
  for(int x:v[c]) if(x<=r) dfs_w(x,r);
}



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 n=_N,m=sz(X),q=sz(L);
  for(int i=0;i<m;i++){
 	int a=X[i],b=Y[i];
 	v[a].push_back(b);
 	v[b].push_back(a);
  }

  vector<int> res(q,0);
  
  for(int i=0;i<q;i++){
   int x=S[i],y=E[i],l=L[i],r=R[i];
   Wvis.assign(n+5,0);
   Hvis.assign(n+5,0);
   dfs_h(x,l);
   dfs_w(y,r);
   bool ok=0;
   for(int i=0;i<n;i++) if(Wvis[i] && Hvis[i]) ok=1;
   res[i]=ok;
  }
  
  return res;
}

/*void _(){
 int n,m,q;
 cin >> n >> m >> q;

 for(int i=0;i<m;i++){
 	int a,b;
 	cin >> a >> b;
 	v[a].push_back(b);
 	v[b].push_back(a);
 }

 while(q--){
  int x,y,l,r;
  cin >> x >> y >> l >> r;
  Wvis.assign(n+5,0);
  Hvis.assign(n+5,0);
  dfs_h(x,l);
  dfs_w(y,r);
  bool ok=0;
  for(int i=0;i<n;i++) if(Wvis[i] && Hvis[i]) ok=1;
  cout << ok;
 }
}

int32_t main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int tc=1;//cin >> tc;
  while(tc--) _();
  return 0;
}*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 508 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 512 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 508 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 512 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 206 ms 848 KB Output is correct
11 Correct 76 ms 872 KB Output is correct
12 Correct 24 ms 968 KB Output is correct
13 Correct 194 ms 848 KB Output is correct
14 Correct 86 ms 848 KB Output is correct
15 Correct 197 ms 1028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 110 ms 27976 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 508 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 512 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 206 ms 848 KB Output is correct
11 Correct 76 ms 872 KB Output is correct
12 Correct 24 ms 968 KB Output is correct
13 Correct 194 ms 848 KB Output is correct
14 Correct 86 ms 848 KB Output is correct
15 Correct 197 ms 1028 KB Output is correct
16 Runtime error 110 ms 27976 KB Execution killed with signal 11
17 Halted 0 ms 0 KB -