답안 #1018306

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018306 2024-07-09T18:39:59 Z vjudge1 늑대인간 (IOI18_werewolf) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma GCC target("popcnt")
#define endl '\n'
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fo(i,n) for(auto i =0 ; i < n;i++)
#define fore(i,l,r) for(auto i = l; i < r;i++)
#define forex(i,r,l) for(auto i = r; i >= l; i--)
#define ffo(i,n) forex(i,n-1,0)
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define sz(x) (int)x.size()
#define gcd(a,b) __gcd(a,b)
#define vii vector<ii>
#define pq_min(a) priority_queue<a, vector<a>, greater<a>>
#define fls cout.flush()
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using ii = pair<int,int>;
using mii = map<int,int>;
using lld = long double;
void valid(ll in){cout<<((in)?"YES\n":"NO\n");}
vi check_validity(int N, vi X, vi Y,vi S, vi E,vi L, vi R) {
    int Q = S.size(), M = sz(X);
    vi ans(Q,0);
    vector<vi> graph(N);
    fo(i,M)graph[X[i]].pb(Y[i]),graph[Y[i]].pb(X[i]);
    fo(i, Q){
        vi ra(N), rb(N);
        queue<int> q;
        if(S[i] >= l)q.push(S[i]);
        while(!q.empty()){
            int nodo = q.front();q.pop();
            for(int v : graph[nodo]){
                if(ra[v]==0&&v>=l){
                    q.push(v);
                    ra[v] = 1;
                }
            }
        }
        if(E[i] <= r)q.push(E[i]);
        while(!q.empty()){
            int nodo = q.front();q.pop();
            for(int v : graph[nodo]){
                if(rb[v]==0&&v<=r){
                    q.push(v);
                    rb[v]=1;
                }
            }
        }
        fo(i,N)
            if(ra[i]&&rb[i])
                ans[i]=1;
    }
    return ans;
}

Compilation message

werewolf.cpp: In function 'vi check_validity(int, vi, vi, vi, vi, vi, vi)':
werewolf.cpp:39:20: error: 'l' was not declared in this scope
   39 |         if(S[i] >= l)q.push(S[i]);
      |                    ^
werewolf.cpp:43:33: error: 'l' was not declared in this scope
   43 |                 if(ra[v]==0&&v>=l){
      |                                 ^
werewolf.cpp:49:20: error: 'r' was not declared in this scope
   49 |         if(E[i] <= r)q.push(E[i]);
      |                    ^
werewolf.cpp:53:33: error: 'r' was not declared in this scope
   53 |                 if(rb[v]==0&&v<=r){
      |                                 ^