This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include <bits/stdc++.h>
using namespace std;
 
//#define int long long
#define ll long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define LB lower_bound
#define UB upper_bound
#define ii pair<int, int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define vi vector<int>
#define vvi vector<vi>
#define vb vector<bool>
#define vvb vector<vb>
#define vs vector<string>
#define vii vector<ii>
#define vvii vector<vii>
#define vll vector<ll>
#define vld vector<ld>
 
int n;
vvi adj;
vi v;
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
 
    cin >> n;
    adj.resize(n);
    v.resize(n);
    for (int i = 0; i < n-1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    bool o = 0;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        if (v[i]) o = 1;
    }
    
    cout << (o ? "impossible\n" : "0\n");
    return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |