Submission #1111538

# Submission time Handle Problem Language Result Execution time Memory
1111538 2024-11-12T09:23:40 Z epicci23 Werewolf (IOI18_werewolf) C++17
Compilation error
0 ms 0 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) {
  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;
}

Compilation message

werewolf.cpp:50:1: error: unterminated comment
   50 | /*void _(){
      | ^
werewolf.cpp: In function 'std::vector<int> check_validity(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
werewolf.cpp:27:3: error: 'n' was not declared in this scope
   27 |   n=_N,m=sz(X),q=sz(L);
      |   ^
werewolf.cpp:27:8: error: 'm' was not declared in this scope
   27 |   n=_N,m=sz(X),q=sz(L);
      |        ^
werewolf.cpp:27:16: error: 'q' was not declared in this scope
   27 |   n=_N,m=sz(X),q=sz(L);
      |                ^