답안 #245532

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245532 2020-07-06T16:26:56 Z Tc14 Political Development (BOI17_politicaldevelopment) C++17
0 / 100
41 ms 1152 KB
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ve vector
typedef long long ll;

int n, k, r;
ve<set<int>> G;
ve<int> S;

void f(int i, int s) {

    bool valid;

    if (i < k) {

        for (int j = s; j < n; j++) {

            valid = true;
            for (int l : S) {
                if (G[l].find(j) == G[l].end() || G[j].find(l) == G[j].end()) {
                    valid = false;
                    break;
                }
            }

            if (valid) {
                S.push_back(i);
                r = max(r, i + 1);
                f(i + 1, j + 1);
                S.pop_back();
            }
        }
    }
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int d, a;

    cin >> n >> k;
    G = ve<set<int>>(n);

    for (int i = 0; i < n; i++) {
        cin >> d;
        for (int j = 0; j < d; j++) {
            cin >> a;
            G[i].insert(a);
        }
    }

    r = 0;
    f(0, 0);

    cout << r << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 41 ms 1152 KB Output is correct
4 Correct 39 ms 1024 KB Output is correct
5 Correct 39 ms 1152 KB Output is correct
6 Correct 37 ms 1152 KB Output is correct
7 Correct 38 ms 1152 KB Output is correct
8 Correct 27 ms 640 KB Output is correct
9 Correct 5 ms 432 KB Output is correct
10 Incorrect 26 ms 640 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 41 ms 1152 KB Output is correct
4 Correct 39 ms 1024 KB Output is correct
5 Correct 39 ms 1152 KB Output is correct
6 Correct 37 ms 1152 KB Output is correct
7 Correct 38 ms 1152 KB Output is correct
8 Correct 27 ms 640 KB Output is correct
9 Correct 5 ms 432 KB Output is correct
10 Incorrect 26 ms 640 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 768 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 41 ms 1152 KB Output is correct
4 Correct 39 ms 1024 KB Output is correct
5 Correct 39 ms 1152 KB Output is correct
6 Correct 37 ms 1152 KB Output is correct
7 Correct 38 ms 1152 KB Output is correct
8 Correct 27 ms 640 KB Output is correct
9 Correct 5 ms 432 KB Output is correct
10 Incorrect 26 ms 640 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 41 ms 1152 KB Output is correct
4 Correct 39 ms 1024 KB Output is correct
5 Correct 39 ms 1152 KB Output is correct
6 Correct 37 ms 1152 KB Output is correct
7 Correct 38 ms 1152 KB Output is correct
8 Correct 27 ms 640 KB Output is correct
9 Correct 5 ms 432 KB Output is correct
10 Incorrect 26 ms 640 KB Output isn't correct