Submission #1056751

#TimeUsernameProblemLanguageResultExecution timeMemory
1056751kachim2The Xana coup (BOI21_xanadu)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
vector<vector<long>> tree;
long N; long bst = long_MAX;
void x(vector<bool> lit, long n, long cnt){
    bool gud = 0;
    for(long i = 1; i <= N; i++) 
        if(lit[i]) gud = 1;
    if(!gud){
        bst = min(bst, cnt);
    }
    if(n==N+1) return;
    x(lit, n+1, cnt);
    lit[n] = !lit[n] ;
    for(auto i : tree[n]) lit[i] = !lit[i];
    x(lit, n+1, cnt+1);
}
int main(){
    long n;
    cin >> n;
    N=n;
    tree.resize(n+1);
    vector<bool> lit(n+1);
    for(long i = 0; i < n-1; i++){
        long a, b;
        cin >> a >> b;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    for(long i = 1; i <= n; i++){
        long x;cin >> x; lit[i] = x;

    }
    x(lit, 1, 0);
    if(bst == long_MAX)
    cout << "imposible";
    else
    cout << bst;


}

Compilation message (stderr)

xanadu.cpp:4:20: error: 'long_MAX' was not declared in this scope
    4 | long N; long bst = long_MAX;
      |                    ^~~~~~~~
xanadu.cpp: In function 'int main()':
xanadu.cpp:35:15: error: 'long_MAX' was not declared in this scope
   35 |     if(bst == long_MAX)
      |               ^~~~~~~~