Submission #889579

# Submission time Handle Problem Language Result Execution time Memory
889579 2023-12-20T03:19:11 Z shiomusubi496 Political Development (BOI17_politicaldevelopment) C++17
4 / 100
31 ms 732 KB
#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(v) begin(v), end(v)

int main() {
    int n, k; cin >> n >> k;
    assert(k <= 3);
    vector<vector<int>> g(n);
    {
        bool f = false;
        rep (i, n) {
            int d; cin >> d;
            if (d) f = true;
            rep (j, d) {
                int a; cin >> a;
                g[i].push_back(a);
            }
        }
        if (!f) {
            puts("1");
            return 0;
        }
    }
    rep (i, n) {
        vector<bool> memo(n, false);
        for (auto j : g[i]) {
            for (auto k : g[j]) {
                if (k == i) continue;
                if (memo[k]) {
                    puts("3");
                    return 0;
                }
                memo[k] = true;
            }
        }
    }
    puts("2");
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 29 ms 600 KB Output is correct
5 Correct 29 ms 604 KB Output is correct
6 Correct 4 ms 604 KB Output is correct
7 Correct 4 ms 604 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 29 ms 600 KB Output is correct
5 Correct 29 ms 604 KB Output is correct
6 Correct 4 ms 604 KB Output is correct
7 Correct 4 ms 604 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 30 ms 732 KB Output is correct
12 Correct 30 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 31 ms 604 KB Output is correct
15 Incorrect 0 ms 344 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 29 ms 600 KB Output is correct
5 Correct 29 ms 604 KB Output is correct
6 Correct 4 ms 604 KB Output is correct
7 Correct 4 ms 604 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 30 ms 732 KB Output is correct
12 Correct 30 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 31 ms 604 KB Output is correct
15 Incorrect 0 ms 344 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 29 ms 600 KB Output is correct
5 Correct 29 ms 604 KB Output is correct
6 Correct 4 ms 604 KB Output is correct
7 Correct 4 ms 604 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 30 ms 732 KB Output is correct
12 Correct 30 ms 604 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 31 ms 604 KB Output is correct
15 Incorrect 0 ms 344 KB Output isn't correct
16 Halted 0 ms 0 KB -