답안 #971484

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
971484 2024-04-28T16:31:18 Z gutzzy Political Development (BOI17_politicaldevelopment) C++14
16 / 100
3000 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, k, d, a;
    cin >> n >> k;
    vector<vector<int>> ady(n,vector<int>(n,0));
    vector<vector<int>> last(n);
    for(int i=0;i<n;i++){
        last[i] = {i};
        cin >> d;
        for(int j=0;j<d;j++){
            cin >> a;
            ady[min(i,a)][max(i,a)] = 1;
        }
    }
    int cur = 2;
    while(cur<=k){
        int s = last.size();
        vector<vector<int>> nw;
        for(int i=0;i<s;i++){
            // last[i] --> completed graphs of cur-1 nodes
            for(int x=0;x<n;x++){
                bool found = true;
                for(auto p:last[i]){
                    if(ady[min(x,p)][max(x,p)]==0){
                        found = false;
                        break;
                    }
                }
                if(found){
                    last[i].push_back(x);
                    nw.push_back(last[i]);
                    last[i].pop_back();
                    //for(int kk=0;kk<last[i].size();kk++) cout << last[i][kk] << " ";
                    //cout << x << endl;
                }
            }
        }
        if(nw.size()==0) break;
        else{
            last = nw;
            cur++;
        }
    }
    cout << cur-1 << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 176 ms 99848 KB Output is correct
4 Correct 179 ms 99984 KB Output is correct
5 Correct 186 ms 99728 KB Output is correct
6 Correct 175 ms 99820 KB Output is correct
7 Correct 177 ms 99764 KB Output is correct
8 Correct 172 ms 98736 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 198 ms 98732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 176 ms 99848 KB Output is correct
4 Correct 179 ms 99984 KB Output is correct
5 Correct 186 ms 99728 KB Output is correct
6 Correct 175 ms 99820 KB Output is correct
7 Correct 177 ms 99764 KB Output is correct
8 Correct 172 ms 98736 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 198 ms 98732 KB Output is correct
11 Correct 174 ms 100236 KB Output is correct
12 Correct 507 ms 99704 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 579 ms 100796 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 455 ms 99776 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 439 ms 99816 KB Output is correct
19 Correct 182 ms 98736 KB Output is correct
20 Correct 301 ms 99152 KB Output is correct
21 Correct 318 ms 99152 KB Output is correct
22 Correct 191 ms 98736 KB Output is correct
23 Correct 496 ms 99964 KB Output is correct
24 Correct 193 ms 98732 KB Output is correct
25 Correct 517 ms 100056 KB Output is correct
26 Correct 471 ms 99868 KB Output is correct
27 Correct 473 ms 99728 KB Output is correct
28 Correct 501 ms 100008 KB Output is correct
29 Correct 429 ms 99724 KB Output is correct
30 Correct 538 ms 100236 KB Output is correct
31 Correct 516 ms 100168 KB Output is correct
32 Correct 528 ms 100144 KB Output is correct
33 Correct 516 ms 100236 KB Output is correct
34 Correct 525 ms 100204 KB Output is correct
35 Correct 96 ms 25864 KB Output is correct
36 Correct 98 ms 25688 KB Output is correct
37 Correct 94 ms 25884 KB Output is correct
38 Correct 30 ms 7000 KB Output is correct
39 Correct 30 ms 7004 KB Output is correct
40 Correct 739 ms 100828 KB Output is correct
41 Correct 29 ms 7008 KB Output is correct
42 Correct 720 ms 100956 KB Output is correct
43 Correct 723 ms 100892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 169 ms 98644 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 432 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 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 Runtime error 251 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 176 ms 99848 KB Output is correct
4 Correct 179 ms 99984 KB Output is correct
5 Correct 186 ms 99728 KB Output is correct
6 Correct 175 ms 99820 KB Output is correct
7 Correct 177 ms 99764 KB Output is correct
8 Correct 172 ms 98736 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 198 ms 98732 KB Output is correct
11 Correct 174 ms 100236 KB Output is correct
12 Correct 507 ms 99704 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 579 ms 100796 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 455 ms 99776 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 439 ms 99816 KB Output is correct
19 Correct 182 ms 98736 KB Output is correct
20 Correct 301 ms 99152 KB Output is correct
21 Correct 318 ms 99152 KB Output is correct
22 Correct 191 ms 98736 KB Output is correct
23 Correct 496 ms 99964 KB Output is correct
24 Correct 193 ms 98732 KB Output is correct
25 Correct 517 ms 100056 KB Output is correct
26 Correct 471 ms 99868 KB Output is correct
27 Correct 473 ms 99728 KB Output is correct
28 Correct 501 ms 100008 KB Output is correct
29 Correct 429 ms 99724 KB Output is correct
30 Correct 538 ms 100236 KB Output is correct
31 Correct 516 ms 100168 KB Output is correct
32 Correct 528 ms 100144 KB Output is correct
33 Correct 516 ms 100236 KB Output is correct
34 Correct 525 ms 100204 KB Output is correct
35 Correct 96 ms 25864 KB Output is correct
36 Correct 98 ms 25688 KB Output is correct
37 Correct 94 ms 25884 KB Output is correct
38 Correct 30 ms 7000 KB Output is correct
39 Correct 30 ms 7004 KB Output is correct
40 Correct 739 ms 100828 KB Output is correct
41 Correct 29 ms 7008 KB Output is correct
42 Correct 720 ms 100956 KB Output is correct
43 Correct 723 ms 100892 KB Output is correct
44 Execution timed out 3051 ms 159200 KB Time limit exceeded
45 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 176 ms 99848 KB Output is correct
4 Correct 179 ms 99984 KB Output is correct
5 Correct 186 ms 99728 KB Output is correct
6 Correct 175 ms 99820 KB Output is correct
7 Correct 177 ms 99764 KB Output is correct
8 Correct 172 ms 98736 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 198 ms 98732 KB Output is correct
11 Correct 174 ms 100236 KB Output is correct
12 Correct 507 ms 99704 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 579 ms 100796 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 455 ms 99776 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 439 ms 99816 KB Output is correct
19 Correct 182 ms 98736 KB Output is correct
20 Correct 301 ms 99152 KB Output is correct
21 Correct 318 ms 99152 KB Output is correct
22 Correct 191 ms 98736 KB Output is correct
23 Correct 496 ms 99964 KB Output is correct
24 Correct 193 ms 98732 KB Output is correct
25 Correct 517 ms 100056 KB Output is correct
26 Correct 471 ms 99868 KB Output is correct
27 Correct 473 ms 99728 KB Output is correct
28 Correct 501 ms 100008 KB Output is correct
29 Correct 429 ms 99724 KB Output is correct
30 Correct 538 ms 100236 KB Output is correct
31 Correct 516 ms 100168 KB Output is correct
32 Correct 528 ms 100144 KB Output is correct
33 Correct 516 ms 100236 KB Output is correct
34 Correct 525 ms 100204 KB Output is correct
35 Correct 96 ms 25864 KB Output is correct
36 Correct 98 ms 25688 KB Output is correct
37 Correct 94 ms 25884 KB Output is correct
38 Correct 30 ms 7000 KB Output is correct
39 Correct 30 ms 7004 KB Output is correct
40 Correct 739 ms 100828 KB Output is correct
41 Correct 29 ms 7008 KB Output is correct
42 Correct 720 ms 100956 KB Output is correct
43 Correct 723 ms 100892 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Runtime error 191 ms 524288 KB Execution killed with signal 9
46 Halted 0 ms 0 KB -