103762024-04-01 16:19:45MagyarKendeSZLGTúra (75 pont)cpp17Wrong answer 10/7535ms28440 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define all(v) v.begin(), v.end()

int N;
vector<bool> ugly;
vector<vector<int>> g;

void solve() {
    cin >> N;
    ugly.assign(N + 1, 0);
    g.assign(N + 1, vector<int>());

    for (int i = 1; i <= N; i++) {
        int A;
        cin >> A;
        ugly[i] = A == -1;
    }

    for (int i = 1; i < N; i++) {
        int U, V;
        cin >> U >> V;
        if (ugly[U] && ugly[V]) {
            cout << "NEM\n2\n" << U << " " << V << "\n";
            //for (i++; i < N; i++) cin >> U >> V;
            return;
        }
    }

    cout << "IGEN\n";
}

int main() {
	cin.tie(0), ios::sync_with_stdio(0);
    int T;
    cin >> T;
    while (T--) solve();
}
SubtaskSumTestVerdictTimeMemory
base10/75
1Accepted0/03ms2100 KiB
2Wrong answer0/03ms2332 KiB
3Wrong answer0/63ms2464 KiB
4Wrong answer0/33ms2836 KiB
5Wrong answer0/33ms2888 KiB
6Wrong answer0/44ms2936 KiB
7Wrong answer0/44ms3180 KiB
8Wrong answer0/43ms3376 KiB
9Wrong answer0/210ms4328 KiB
10Wrong answer0/26ms4928 KiB
11Wrong answer0/214ms5572 KiB
12Wrong answer0/217ms6388 KiB
13Wrong answer0/227ms7636 KiB
14Wrong answer0/314ms8336 KiB
15Wrong answer0/26ms8712 KiB
16Accepted2/228ms9848 KiB
17Wrong answer0/229ms11196 KiB
18Wrong answer0/230ms12452 KiB
19Wrong answer0/330ms13604 KiB
20Wrong answer0/229ms14752 KiB
21Wrong answer0/232ms16040 KiB
22Wrong answer0/38ms16636 KiB
23Accepted2/212ms21304 KiB
24Accepted2/232ms22576 KiB
25Wrong answer0/29ms20688 KiB
26Wrong answer0/217ms21568 KiB
27Wrong answer0/232ms22896 KiB
28Wrong answer0/234ms24204 KiB
29Wrong answer0/218ms25080 KiB
30Wrong answer0/214ms25784 KiB
31Accepted2/235ms26968 KiB
32Accepted2/235ms28440 KiB