78912024-01-11 18:13:56AblablablaTúra (75 pont)cpp17Wrong answer 4/7556ms15640 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t;
    cin >> t;

    while(t--){
        int n;
        cin >> n;

        vector<bool> jo(n, 0);
        for(int i = 0; i < n; i++){
            int a;
            cin >> a;

            jo[i] = (a == 1);
        }

        vector<vector<int>> csucsok(n, vector<int>());
        for(int i = 0; i < n - 1; i++){
            int a, b;
            cin >> a >> b;
            a--; b--;

            csucsok[a].push_back(b);
            csucsok[b].push_back(a);
        }

        bool rossz = 0;
        for(int i = 0; i < n; i++){
            if(jo[i]) continue;

            for(int x : csucsok[i]){
                if(!jo[x]){
                    cout << "NEM\n";
                    cout << "2\n";
                    cout << i + 1 << " " << x << "\n";
                    rossz = 1;
                } else{
                    for(int y : csucsok[x]){
                        if(!jo[y] && y != i){
                            cout << "NEM\n";
                            cout << "3\n";
                            cout << i + 1 << " " << x << " " << y << "\n";
                            rossz = 1;
                        }

                        if(rossz){
                            break;
                        }
                    }
                }

                if(rossz){
                    break;
                }
            }

            if(rossz){
                break;
            }
        }

        if(!rossz){
            cout << "IGEN\n";
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base4/75
1Accepted0/03ms1824 KiB
2Wrong answer0/03ms2212 KiB
3Wrong answer0/63ms2276 KiB
4Wrong answer0/37ms2636 KiB
5Wrong answer0/37ms2868 KiB
6Wrong answer0/46ms2932 KiB
7Wrong answer0/46ms2848 KiB
8Wrong answer0/46ms3104 KiB
9Wrong answer0/243ms4076 KiB
10Wrong answer0/245ms4336 KiB
11Wrong answer0/243ms4280 KiB
12Wrong answer0/243ms4276 KiB
13Wrong answer0/245ms4336 KiB
14Wrong answer0/343ms4532 KiB
15Wrong answer0/245ms4852 KiB
16Wrong answer0/243ms4700 KiB
17Wrong answer0/243ms4700 KiB
18Wrong answer0/241ms4736 KiB
19Wrong answer0/341ms4868 KiB
20Wrong answer0/241ms4804 KiB
21Wrong answer0/243ms4800 KiB
22Wrong answer0/345ms5016 KiB
23Wrong answer0/250ms15640 KiB
24Wrong answer0/250ms15068 KiB
25Wrong answer0/250ms9796 KiB
26Wrong answer0/246ms10300 KiB
27Wrong answer0/248ms9656 KiB
28Wrong answer0/246ms10168 KiB
29Wrong answer0/250ms9668 KiB
30Wrong answer0/246ms10068 KiB
31Accepted2/250ms9996 KiB
32Accepted2/256ms9904 KiB