244832026-02-12 09:28:32Leventusz09Bizonyításcpp17Runtime error 0/50787ms6816 KiB
#include <iostream>
#include <vector>
#define DEBUG false
using namespace std;

struct Statement {
    int x;
    int y;
    int t;
};

int RM[500][500];
// -1 => nincs út

int main()
{
    int N, Q;
    cin >> N >> Q;

    for(int i=0; i<N; i++) for(int j=0; j<N; j++) RM[i][j] = -1;

    vector<Statement> T;
    for(int q=0; q<Q; q++){
        int t, x, y;
        x--; y--;
        cin >> t >> x >> y;
        if(t == 1){
            RM[x][y] = q + 1;
            #if DEBUG
            cout << "D" << RM[x][y] << endl;
            #endif
        }else{
            Statement question;
            question.x = x;
            question.y = y;
            question.t = q+1;
            T.push_back(question);
        }
    }

    ///
    for(int _=0; _<1; _++){
        for(int f=0; f<N; f++){
            for(int t=0; t<N; t++){
                if(f==t || RM[f][t] == -1) continue;
                for(int n=0; n<N; n++){
                    if(t==n || f==n || RM[t][n] == -1) continue;
                    int mp = max(RM[f][t], RM[t][n]);
                    if(RM[f][n] == -1) RM[f][n] = mp;
                    if(RM[f][n] > mp) RM[f][n] = mp;
                }
            }
        }
    }

    #if DEBUG
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            cout << RM[i][j] << " ";
        }
        cout << endl;
    }
    #endif


    for(int i=0; i<T.size(); i++){
        int rm = RM[T[i].x][T[i].y];
        if(rm == -1 || rm > T[i].t) cout << "NEM" << endl;
        else cout << "IGEN" << endl;
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms316 KiB
2Runtime error52ms2096 KiB
subtask20/10
3Wrong answer4ms564 KiB
4Wrong answer35ms820 KiB
5Wrong answer365ms1780 KiB
6Accepted216ms1784 KiB
7Accepted211ms1588 KiB
8Wrong answer6ms820 KiB
9Accepted3ms316 KiB
10Wrong answer41ms820 KiB
11Wrong answer157ms1520 KiB
12Wrong answer270ms1588 KiB
subtask30/15
13Accepted1ms316 KiB
14Wrong answer3ms508 KiB
15Wrong answer2ms316 KiB
16Wrong answer2ms316 KiB
17Wrong answer1ms316 KiB
18Wrong answer2ms508 KiB
19Wrong answer1ms316 KiB
20Wrong answer1ms316 KiB
21Wrong answer1ms316 KiB
22Wrong answer2ms508 KiB
23Wrong answer2ms316 KiB
24Wrong answer1ms544 KiB
25Wrong answer2ms324 KiB
26Wrong answer2ms316 KiB
27Wrong answer1ms460 KiB
28Wrong answer2ms316 KiB
29Wrong answer2ms760 KiB
30Wrong answer1ms508 KiB
31Wrong answer2ms316 KiB
32Wrong answer1ms316 KiB
33Wrong answer1ms316 KiB
34Wrong answer1ms316 KiB
35Wrong answer1ms316 KiB
36Wrong answer2ms316 KiB
37Wrong answer2ms316 KiB
38Wrong answer1ms316 KiB
subtask40/25
39Accepted1ms316 KiB
40Runtime error54ms2220 KiB
41Wrong answer4ms564 KiB
42Wrong answer35ms820 KiB
43Wrong answer365ms1780 KiB
44Accepted216ms1784 KiB
45Accepted211ms1588 KiB
46Wrong answer6ms820 KiB
47Accepted3ms316 KiB
48Wrong answer41ms820 KiB
49Wrong answer157ms1520 KiB
50Wrong answer270ms1588 KiB
51Wrong answer3ms508 KiB
52Wrong answer2ms316 KiB
53Wrong answer2ms316 KiB
54Wrong answer1ms316 KiB
55Wrong answer2ms508 KiB
56Wrong answer1ms316 KiB
57Wrong answer1ms316 KiB
58Wrong answer1ms316 KiB
59Wrong answer2ms508 KiB
60Wrong answer2ms316 KiB
61Wrong answer1ms544 KiB
62Wrong answer2ms324 KiB
63Wrong answer2ms316 KiB
64Wrong answer1ms460 KiB
65Wrong answer2ms316 KiB
66Wrong answer2ms760 KiB
67Wrong answer1ms508 KiB
68Wrong answer2ms316 KiB
69Wrong answer1ms316 KiB
70Wrong answer1ms316 KiB
71Wrong answer1ms316 KiB
72Wrong answer1ms316 KiB
73Wrong answer2ms316 KiB
74Wrong answer2ms316 KiB
75Wrong answer1ms316 KiB
76Wrong answer164ms2068 KiB
77Wrong answer123ms1276 KiB
78Wrong answer628ms2964 KiB
79Wrong answer111ms1076 KiB
80Wrong answer437ms2988 KiB
81Wrong answer143ms1708 KiB
82Wrong answer149ms1708 KiB
83Wrong answer158ms1268 KiB
84Wrong answer284ms1840 KiB
85Wrong answer523ms2220 KiB
86Wrong answer247ms2960 KiB
87Wrong answer449ms2732 KiB
88Wrong answer165ms1524 KiB
89Wrong answer218ms1524 KiB
90Wrong answer449ms4768 KiB
91Accepted787ms2220 KiB
92Wrong answer442ms6816 KiB
93Accepted648ms2220 KiB
94Wrong answer441ms6812 KiB
95Runtime error12ms1588 KiB
96Runtime error7ms1332 KiB
97Runtime error57ms1384 KiB
98Wrong answer321ms3492 KiB
99Runtime error39ms1336 KiB
100Wrong answer555ms4768 KiB
101Wrong answer560ms4788 KiB
102Wrong answer625ms5280 KiB
103Wrong answer648ms5364 KiB
104Wrong answer521ms4744 KiB