54072023-05-12 18:31:23mraronSzéfnyitáscpp17Wrong answer 16/1003ms4740 KiB
#include <bits/stdc++.h>

using ll = long long;
using namespace std;
const ll INF = 1e18;

const int MAXN = 151;

int a[MAXN], b[MAXN];
int s[MAXN][2], s2[MAXN][2];

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n, k; cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> s[i][0] >> s[i][1];
    }

    cin >> k;

    b[1] = 0;
    b[2] = 1;

    for (int i = 1; i <= 2; i++) {
        for (int j = 1; j <= 2; j++) {
            for (int c = 1; c <= 2; c++) {
                for (int d = 1; d <= 2; d++) {
                    s2[1][0] = i;
                    s2[1][1] = j;
                    s2[2][0] = c;
                    s2[2][1] = d;
                    bool g = true;
                    for (int start = 1; start <= n && g; start++) {
                        int left = k;
                        int stB = 1;
                        int st = start;
                        for (int it = 0; it <= 10; it++) {
                            int o1 = a[st];
                            int o2 = b[stB];
                            if (o1 != o2) {
                                if (left == 0) {
                                    g = false;
                                    break;
                                }
                                left--;
                            }
                            st = s[st][o2];
                            stB = s2[stB][o1];
                        }
                    }

                    if (g) {
                        cout << "2 1\n";
                        cout << b[1] << " " << s2[1][0] << " " << s2[1][1] << "\n" << b[2] << " " << s2[2][0] << " " << s2[2][1] << "\n";
                        exit(0);
                    }
                }
            }
        }
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms2024 KiB
2Accepted3ms2200 KiB
subtask216/16
3Accepted3ms2200 KiB
4Accepted3ms2412 KiB
5Accepted3ms2620 KiB
6Accepted3ms2832 KiB
7Accepted3ms2976 KiB
8Accepted3ms3176 KiB
9Accepted3ms3292 KiB
10Accepted2ms3348 KiB
11Accepted2ms3348 KiB
12Accepted3ms3476 KiB
13Accepted3ms3688 KiB
14Accepted2ms3772 KiB
subtask30/24
15Accepted2ms3772 KiB
16Wrong answer3ms3904 KiB
17Wrong answer2ms3992 KiB
18Wrong answer3ms4084 KiB
19Wrong answer2ms3992 KiB
20Wrong answer3ms4140 KiB
21Wrong answer2ms4184 KiB
22Wrong answer2ms4072 KiB
23Wrong answer3ms4172 KiB
subtask40/23
24Wrong answer3ms4172 KiB
25Wrong answer2ms4172 KiB
26Wrong answer2ms4172 KiB
27Wrong answer2ms4304 KiB
28Wrong answer2ms4208 KiB
29Wrong answer3ms4204 KiB
30Wrong answer3ms4204 KiB
31Wrong answer2ms4296 KiB
32Wrong answer2ms4300 KiB
subtask50/37
33Wrong answer2ms4300 KiB
34Accepted3ms2412 KiB
35Accepted3ms2620 KiB
36Accepted3ms2832 KiB
37Accepted3ms2976 KiB
38Accepted3ms3176 KiB
39Accepted3ms3292 KiB
40Accepted2ms3348 KiB
41Accepted2ms3348 KiB
42Accepted3ms3476 KiB
43Accepted3ms3688 KiB
44Accepted2ms3772 KiB
45Wrong answer3ms3904 KiB
46Wrong answer2ms3992 KiB
47Wrong answer3ms4084 KiB
48Wrong answer2ms3992 KiB
49Wrong answer3ms4140 KiB
50Wrong answer2ms4184 KiB
51Wrong answer2ms4072 KiB
52Wrong answer3ms4172 KiB
53Wrong answer2ms4172 KiB
54Wrong answer2ms4172 KiB
55Wrong answer2ms4304 KiB
56Wrong answer2ms4208 KiB
57Wrong answer3ms4204 KiB
58Wrong answer3ms4204 KiB
59Wrong answer2ms4296 KiB
60Wrong answer2ms4300 KiB
61Wrong answer3ms4204 KiB
62Wrong answer2ms4204 KiB
63Wrong answer3ms4172 KiB
64Wrong answer2ms4204 KiB
65Wrong answer3ms4476 KiB
66Wrong answer2ms4348 KiB
67Wrong answer2ms4448 KiB
68Wrong answer3ms4512 KiB
69Wrong answer3ms4740 KiB
70Wrong answer3ms4716 KiB
71Wrong answer3ms4624 KiB
72Wrong answer3ms4708 KiB