Submission #990261

#TimeUsernameProblemLanguageResultExecution timeMemory
990261woodWerewolf (IOI18_werewolf)C++17
Compilation error
0 ms0 KiB
#include "werewolf.h"
#include <bits/stdc++.h>  
using namespace std;
 
typedef long long ll;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vi vector<int>
#define vp32 vector<p32>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MOD %1000000007
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//never guess
//never debug without reviewing code
//never try adding ones or substracting them
//only step by step debug when necessay

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) {
    vi adj[N];
    vi res;
    for(int i = 0; i<X.size(); i++){
        adj[X[i]].pb(Y[i]);
        adj[Y[i]].pb(X[i]);
    }
    for (size_t i = 0; i < S.size(); i++)
    {
        int done[N];
        memset(done,0,sizeof done);
        stack<int> st;
        st.push(S[i]);
        while(!st.empty()){
            int x = st.top();
            st.pop();
            done[x] = 1;
            for(int a : adj[x]){
                if(done[a]||a<L[i]) continue;
                st.push(a);
            }
        }
        st.push(E[i]);
        while(!st.empty()){
            int x = st.top();
            st.pop();
            if(done[a]==1) goto yes;
            for(int a : adj[x]){
                if(done[a]==2||a>R[i]) continue;
                st.push(a);
            }
        }
        res.pb(0);
        continue;
    yes:
        res.pb(1);
    }
    return res;
}

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:31:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i = 0; i<X.size(); i++){
      |                    ~^~~~~~~~~
werewolf.cpp:54:21: error: 'a' was not declared in this scope
   54 |             if(done[a]==1) goto yes;
      |                     ^