Submission #711640

# Submission time Handle Problem Language Result Execution time Memory
711640 2023-03-17T10:25:58 Z becaido Checker (COCI19_checker) C++17
110 / 110
289 ms 62680 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;

#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof... (u) ? ", " : ""), dout (u...);}
#else
#define debug(...) 7122
#endif

#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second

const int SIZE = 2e5 + 5;

int subtask, n, ans = 2;
vector<int> adj[SIZE];
unordered_map<int, int> mp[SIZE];

void solve() {
    cin >> subtask >> n;
    string s;
    cin >> s, s = " " + s;
    FOR (i, 1, n - 1) {
        adj[i].pb(i + 1);
        mp[i][i + 1] = s[i] - '0';
    }
    adj[1].pb(n);
    mp[1][n] = s[n] - '0';

    FOR (i, 1, n - 3) {
        int a, b, c;
        cin >> a >> b >> c;
        if (a > b) swap(a, b);
        adj[a].pb(b);
        mp[a][b] = c;
    }
    FOR (i, 1, n) sort(adj[i].begin(), adj[i].end());

    FOR (i, 1, n) {
        for (int j = 0; j + 1 < adj[i].size(); j++) {
            int a = i, b = adj[i][j], c = adj[i][j + 1];
            if (!mp[b].count(c)) {
                ans = min(ans, 0);
                break;
            }
            int c1 = mp[a][b], c2 = mp[a][c], c3 = mp[b][c];
            if ((c1 ^ c2 ^ c3) != 0) ans = min(ans, 1);
        }
    }
    cout << (ans == 0 ? "neispravna triangulacija" : ans == 1 ? "neispravno bojenje" : "tocno") << '\n';
}

int main() {
    Waimai;
    solve();
}

Compilation message

checker.cpp: In function 'void solve()':
checker.cpp:49:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         for (int j = 0; j + 1 < adj[i].size(); j++) {
      |                         ~~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 15 ms 15984 KB Output is correct
2 Correct 15 ms 15932 KB Output is correct
3 Correct 11 ms 15980 KB Output is correct
4 Correct 15 ms 15956 KB Output is correct
5 Correct 13 ms 15956 KB Output is correct
6 Correct 11 ms 15956 KB Output is correct
7 Correct 10 ms 15924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 15984 KB Output is correct
2 Correct 15 ms 15932 KB Output is correct
3 Correct 11 ms 15980 KB Output is correct
4 Correct 15 ms 15956 KB Output is correct
5 Correct 13 ms 15956 KB Output is correct
6 Correct 11 ms 15956 KB Output is correct
7 Correct 10 ms 15924 KB Output is correct
8 Correct 11 ms 16376 KB Output is correct
9 Correct 17 ms 16416 KB Output is correct
10 Correct 11 ms 16380 KB Output is correct
11 Correct 14 ms 16380 KB Output is correct
12 Correct 11 ms 16392 KB Output is correct
13 Correct 12 ms 16344 KB Output is correct
14 Correct 13 ms 16296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 286 ms 60188 KB Output is correct
2 Correct 289 ms 60124 KB Output is correct
3 Correct 259 ms 60156 KB Output is correct
4 Correct 246 ms 60160 KB Output is correct
5 Correct 245 ms 60168 KB Output is correct
6 Correct 244 ms 59936 KB Output is correct
7 Correct 168 ms 62612 KB Output is correct
8 Correct 197 ms 62032 KB Output is correct
9 Correct 185 ms 62600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 261 ms 60192 KB Output is correct
2 Correct 254 ms 60136 KB Output is correct
3 Correct 280 ms 60140 KB Output is correct
4 Correct 231 ms 60092 KB Output is correct
5 Correct 236 ms 60148 KB Output is correct
6 Correct 199 ms 60924 KB Output is correct
7 Correct 210 ms 62180 KB Output is correct
8 Correct 236 ms 60120 KB Output is correct
9 Correct 168 ms 62680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 15984 KB Output is correct
2 Correct 15 ms 15932 KB Output is correct
3 Correct 11 ms 15980 KB Output is correct
4 Correct 15 ms 15956 KB Output is correct
5 Correct 13 ms 15956 KB Output is correct
6 Correct 11 ms 15956 KB Output is correct
7 Correct 10 ms 15924 KB Output is correct
8 Correct 11 ms 16376 KB Output is correct
9 Correct 17 ms 16416 KB Output is correct
10 Correct 11 ms 16380 KB Output is correct
11 Correct 14 ms 16380 KB Output is correct
12 Correct 11 ms 16392 KB Output is correct
13 Correct 12 ms 16344 KB Output is correct
14 Correct 13 ms 16296 KB Output is correct
15 Correct 286 ms 60188 KB Output is correct
16 Correct 289 ms 60124 KB Output is correct
17 Correct 259 ms 60156 KB Output is correct
18 Correct 246 ms 60160 KB Output is correct
19 Correct 245 ms 60168 KB Output is correct
20 Correct 244 ms 59936 KB Output is correct
21 Correct 168 ms 62612 KB Output is correct
22 Correct 197 ms 62032 KB Output is correct
23 Correct 185 ms 62600 KB Output is correct
24 Correct 261 ms 60192 KB Output is correct
25 Correct 254 ms 60136 KB Output is correct
26 Correct 280 ms 60140 KB Output is correct
27 Correct 231 ms 60092 KB Output is correct
28 Correct 236 ms 60148 KB Output is correct
29 Correct 199 ms 60924 KB Output is correct
30 Correct 210 ms 62180 KB Output is correct
31 Correct 236 ms 60120 KB Output is correct
32 Correct 168 ms 62680 KB Output is correct
33 Correct 244 ms 60084 KB Output is correct
34 Correct 226 ms 60212 KB Output is correct
35 Correct 222 ms 60108 KB Output is correct
36 Correct 273 ms 60184 KB Output is correct
37 Correct 240 ms 60200 KB Output is correct
38 Correct 256 ms 60148 KB Output is correct
39 Correct 262 ms 60108 KB Output is correct
40 Correct 230 ms 60208 KB Output is correct
41 Correct 198 ms 62200 KB Output is correct
42 Correct 217 ms 60940 KB Output is correct
43 Correct 223 ms 60296 KB Output is correct