답안 #971494

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

int32_t 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;
    bool optim = false;
    while(cur<=k){
        int s = last.size();
        vector<vector<int>> nw;
        for(int i=0;i<s;i++){
            if(optim) break;
            // last[i] --> completed graphs of cur-1 nodes
            for(int x=0;x<n;x++){
                if (optim) break;
                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(cur==k) optim = true;
                }
            }
        }
        if(nw.size()==0) break;
        else{
            last = nw;
            cur++;
        }
    }
    cout << cur-1 << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 22 ms 49752 KB Output is correct
4 Correct 23 ms 49752 KB Output is correct
5 Correct 23 ms 49752 KB Output is correct
6 Correct 25 ms 49752 KB Output is correct
7 Correct 23 ms 49752 KB Output is correct
8 Correct 151 ms 49756 KB Output is correct
9 Correct 1 ms 504 KB Output is correct
10 Correct 25 ms 49756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 22 ms 49752 KB Output is correct
4 Correct 23 ms 49752 KB Output is correct
5 Correct 23 ms 49752 KB Output is correct
6 Correct 25 ms 49752 KB Output is correct
7 Correct 23 ms 49752 KB Output is correct
8 Correct 151 ms 49756 KB Output is correct
9 Correct 1 ms 504 KB Output is correct
10 Correct 25 ms 49756 KB Output is correct
11 Correct 25 ms 49752 KB Output is correct
12 Correct 455 ms 50832 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 513 ms 50860 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 409 ms 51104 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 431 ms 50908 KB Output is correct
19 Correct 142 ms 49756 KB Output is correct
20 Correct 174 ms 50256 KB Output is correct
21 Correct 147 ms 50552 KB Output is correct
22 Correct 147 ms 49812 KB Output is correct
23 Correct 151 ms 51084 KB Output is correct
24 Correct 143 ms 49756 KB Output is correct
25 Correct 190 ms 51224 KB Output is correct
26 Correct 445 ms 50980 KB Output is correct
27 Correct 397 ms 50844 KB Output is correct
28 Correct 456 ms 51088 KB Output is correct
29 Correct 420 ms 50888 KB Output is correct
30 Correct 476 ms 51344 KB Output is correct
31 Correct 474 ms 51132 KB Output is correct
32 Correct 467 ms 51344 KB Output is correct
33 Correct 506 ms 51096 KB Output is correct
34 Correct 459 ms 51600 KB Output is correct
35 Correct 97 ms 13660 KB Output is correct
36 Correct 82 ms 13568 KB Output is correct
37 Correct 82 ms 13652 KB Output is correct
38 Correct 23 ms 3932 KB Output is correct
39 Correct 23 ms 3932 KB Output is correct
40 Correct 149 ms 52064 KB Output is correct
41 Correct 23 ms 3932 KB Output is correct
42 Correct 158 ms 52016 KB Output is correct
43 Correct 158 ms 52092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 142 ms 49812 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Runtime error 253 ms 524288 KB Execution killed with signal 9
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 22 ms 49752 KB Output is correct
4 Correct 23 ms 49752 KB Output is correct
5 Correct 23 ms 49752 KB Output is correct
6 Correct 25 ms 49752 KB Output is correct
7 Correct 23 ms 49752 KB Output is correct
8 Correct 151 ms 49756 KB Output is correct
9 Correct 1 ms 504 KB Output is correct
10 Correct 25 ms 49756 KB Output is correct
11 Correct 25 ms 49752 KB Output is correct
12 Correct 455 ms 50832 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 513 ms 50860 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 409 ms 51104 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 431 ms 50908 KB Output is correct
19 Correct 142 ms 49756 KB Output is correct
20 Correct 174 ms 50256 KB Output is correct
21 Correct 147 ms 50552 KB Output is correct
22 Correct 147 ms 49812 KB Output is correct
23 Correct 151 ms 51084 KB Output is correct
24 Correct 143 ms 49756 KB Output is correct
25 Correct 190 ms 51224 KB Output is correct
26 Correct 445 ms 50980 KB Output is correct
27 Correct 397 ms 50844 KB Output is correct
28 Correct 456 ms 51088 KB Output is correct
29 Correct 420 ms 50888 KB Output is correct
30 Correct 476 ms 51344 KB Output is correct
31 Correct 474 ms 51132 KB Output is correct
32 Correct 467 ms 51344 KB Output is correct
33 Correct 506 ms 51096 KB Output is correct
34 Correct 459 ms 51600 KB Output is correct
35 Correct 97 ms 13660 KB Output is correct
36 Correct 82 ms 13568 KB Output is correct
37 Correct 82 ms 13652 KB Output is correct
38 Correct 23 ms 3932 KB Output is correct
39 Correct 23 ms 3932 KB Output is correct
40 Correct 149 ms 52064 KB Output is correct
41 Correct 23 ms 3932 KB Output is correct
42 Correct 158 ms 52016 KB Output is correct
43 Correct 158 ms 52092 KB Output is correct
44 Incorrect 2837 ms 82928 KB Output isn't correct
45 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 22 ms 49752 KB Output is correct
4 Correct 23 ms 49752 KB Output is correct
5 Correct 23 ms 49752 KB Output is correct
6 Correct 25 ms 49752 KB Output is correct
7 Correct 23 ms 49752 KB Output is correct
8 Correct 151 ms 49756 KB Output is correct
9 Correct 1 ms 504 KB Output is correct
10 Correct 25 ms 49756 KB Output is correct
11 Correct 25 ms 49752 KB Output is correct
12 Correct 455 ms 50832 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 513 ms 50860 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 409 ms 51104 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 431 ms 50908 KB Output is correct
19 Correct 142 ms 49756 KB Output is correct
20 Correct 174 ms 50256 KB Output is correct
21 Correct 147 ms 50552 KB Output is correct
22 Correct 147 ms 49812 KB Output is correct
23 Correct 151 ms 51084 KB Output is correct
24 Correct 143 ms 49756 KB Output is correct
25 Correct 190 ms 51224 KB Output is correct
26 Correct 445 ms 50980 KB Output is correct
27 Correct 397 ms 50844 KB Output is correct
28 Correct 456 ms 51088 KB Output is correct
29 Correct 420 ms 50888 KB Output is correct
30 Correct 476 ms 51344 KB Output is correct
31 Correct 474 ms 51132 KB Output is correct
32 Correct 467 ms 51344 KB Output is correct
33 Correct 506 ms 51096 KB Output is correct
34 Correct 459 ms 51600 KB Output is correct
35 Correct 97 ms 13660 KB Output is correct
36 Correct 82 ms 13568 KB Output is correct
37 Correct 82 ms 13652 KB Output is correct
38 Correct 23 ms 3932 KB Output is correct
39 Correct 23 ms 3932 KB Output is correct
40 Correct 149 ms 52064 KB Output is correct
41 Correct 23 ms 3932 KB Output is correct
42 Correct 158 ms 52016 KB Output is correct
43 Correct 158 ms 52092 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Runtime error 187 ms 524288 KB Execution killed with signal 9
46 Halted 0 ms 0 KB -