Submission #333586

#TimeUsernameProblemLanguageResultExecution timeMemory
333586nicholaskWerewolf (IOI18_werewolf)C++14
Compilation error
0 ms0 KiB
#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; for (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:; } return ans; }

Compilation message (stderr)

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:37:16: error: expected ';' before ')' token
   37 |    for (j<=r[i]){
      |                ^
      |                ;
werewolf.cpp:37:10: warning: value computed is not used [-Wunused-value]
   37 |    for (j<=r[i]){
werewolf.cpp:41:4: error: expected primary-expression before 'while'
   41 |    while (!q.empty()){
      |    ^~~~~
werewolf.cpp:40:5: error: expected ';' before 'while'
   40 |    }
      |     ^
      |     ;
   41 |    while (!q.empty()){
      |    ~~~~~
werewolf.cpp:41:4: error: expected primary-expression before 'while'
   41 |    while (!q.empty()){
      |    ^~~~~
werewolf.cpp:40:5: error: expected ')' before 'while'
   40 |    }
      |     ^
      |     )
   41 |    while (!q.empty()){
      |    ~~~~~
werewolf.cpp:37:8: note: to match this '('
   37 |    for (j<=r[i]){
      |        ^