Submission #889578

# Submission time Handle Problem Language Result Execution time Memory
889578 2023-12-20T03:18:47 Z shiomusubi496 Political Development (BOI17_politicaldevelopment) C++17
Compilation error
0 ms 0 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;
                }
                memo[k] = true;
            }
        }
    }
    puts("2");
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:35:21: error: return-statement with no value, in function returning 'int' [-fpermissive]
   35 |                     return;
      |                     ^~~~~~