Submission #711791

# Submission time Handle Problem Language Result Execution time Memory
711791 2023-03-17T13:55:50 Z Luicosas Checker (COCI19_checker) C++17
110 / 110
107 ms 4724 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define sz(x) (int)(x.size())
#define itr(x) x.begin(), x.end()
#define prv(x) for(auto& i : x) cout << i << " "; cout << "\n";
#ifdef LOCAL
#define debug(...) cerr << #__VA_ARGS__ << " : "; for(auto& i : {__VA_ARGS__}) cerr << i << " "; cerr << "\n";
#else 
#define debug(...)
#endif

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

    int n, t;
    cin >> t >> n;

    string s;
    cin >> s;

    vector<array<int,2>> nxt(n);
    for(int i = 0; i < n; i++) {
        nxt[i] = {(i + 1) % n, s[i] - '0'};
    }

    vector<array<int,3>> E(n - 3);
    for(int i = 0; i < n - 3; i++) {
        cin >> E[i][0] >> E[i][1] >> E[i][2];
        E[i][0]--; E[i][1]--;
        if((E[i][1] - E[i][0] + n) % n > (E[i][0] - E[i][1] + n) % n){
            swap(E[i][0], E[i][1]);
        }
    }
    sort(itr(E), [&](auto& a, auto& b) {
        return (a[1] - a[0] + n) % n < (b[1] - b[0] + n) % n;
    });

    int triged = 1, colored = 1;
    for(auto& e : E) {
        if(nxt[e[0]][0] == -1 || nxt[nxt[e[0]][0]][0] != e[1]) {
            triged = 0;
            break;
        }
        if(e[2] ^ nxt[e[0]][1] ^ nxt[nxt[e[0]][0]][1]) {
            colored = 0;
        }
        nxt[nxt[e[0]][0]] = {-1, 0};
        nxt[e[0]] = {e[1], e[2]};
    }

    int xr = 0;
    for(int i = 0; i < n; i++) {
        xr ^= nxt[i][1];
    }
    colored &= (xr == 0);
    
    if(!triged) {
        cout << "neispravna triangulacija\n";
    } else if(!colored) {
        cout << "neispravno bojenje\n";
    } else {
        cout << "tocno\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 336 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 2 ms 324 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 4624 KB Output is correct
2 Correct 90 ms 4540 KB Output is correct
3 Correct 85 ms 4448 KB Output is correct
4 Correct 81 ms 4448 KB Output is correct
5 Correct 78 ms 4548 KB Output is correct
6 Correct 91 ms 4540 KB Output is correct
7 Correct 100 ms 4544 KB Output is correct
8 Correct 93 ms 4540 KB Output is correct
9 Correct 90 ms 4540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 4584 KB Output is correct
2 Correct 81 ms 4548 KB Output is correct
3 Correct 88 ms 4624 KB Output is correct
4 Correct 84 ms 4600 KB Output is correct
5 Correct 79 ms 4596 KB Output is correct
6 Correct 98 ms 4576 KB Output is correct
7 Correct 96 ms 4716 KB Output is correct
8 Correct 107 ms 4612 KB Output is correct
9 Correct 103 ms 4568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 336 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 2 ms 324 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 84 ms 4624 KB Output is correct
16 Correct 90 ms 4540 KB Output is correct
17 Correct 85 ms 4448 KB Output is correct
18 Correct 81 ms 4448 KB Output is correct
19 Correct 78 ms 4548 KB Output is correct
20 Correct 91 ms 4540 KB Output is correct
21 Correct 100 ms 4544 KB Output is correct
22 Correct 93 ms 4540 KB Output is correct
23 Correct 90 ms 4540 KB Output is correct
24 Correct 80 ms 4584 KB Output is correct
25 Correct 81 ms 4548 KB Output is correct
26 Correct 88 ms 4624 KB Output is correct
27 Correct 84 ms 4600 KB Output is correct
28 Correct 79 ms 4596 KB Output is correct
29 Correct 98 ms 4576 KB Output is correct
30 Correct 96 ms 4716 KB Output is correct
31 Correct 107 ms 4612 KB Output is correct
32 Correct 103 ms 4568 KB Output is correct
33 Correct 81 ms 4576 KB Output is correct
34 Correct 82 ms 4616 KB Output is correct
35 Correct 83 ms 4724 KB Output is correct
36 Correct 82 ms 4592 KB Output is correct
37 Correct 83 ms 4560 KB Output is correct
38 Correct 78 ms 4568 KB Output is correct
39 Correct 84 ms 4564 KB Output is correct
40 Correct 92 ms 4620 KB Output is correct
41 Correct 100 ms 4692 KB Output is correct
42 Correct 96 ms 4576 KB Output is correct
43 Correct 90 ms 4616 KB Output is correct