답안 #1035182

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1035182 2024-07-26T05:57:20 Z Hectorungo_18 Political Development (BOI17_politicaldevelopment) C++14
4 / 100
144 ms 3820 KB
#include <bits/stdc++.h>
using namespace std;
 
string abc = "abcdefghijklmnopqrstuvwxyz";
 
// #define int long long
 
void solve(){
    int n, k;
    cin >> n >> k;
    vector<vector<bool>> b(n+3, vector<bool> (n+3, 0));
    vector<int> v;
    for(int i = 0; i < n; i++){
        int r;
        cin >> r;
        for(int j = 0; j < r; j++){
            int a;
            cin >> a;
            b[i][a]=1;
        
        }
        if(r < k) v.push_back(i);
    }
    // for(int i = 0; i < n; i++){
    //     for(int j = 0; j < n; j++){
    //         // cout << i << " " << j << " " <<b[i][j] << endl;
    //     }
    //     // cout << endl;
    // }
    int sz = 0;
    for(int i = 0; i < v.size(); i++){
        int a = v[i];
        set<int> s;
        s.insert(a);
        for(int j = 0; j < n; j++){
            if(b[a][j] == 1) s.insert(j);
            else continue;
            // cout << "in  " << a << " " << j << endl;
        }
        bool im = 0;
        for(auto x : s){
            // cout << x << endl;
            int sz = 0;
            for(int j = 0; j < n; j++){
                if(j == x) continue;
                if(s.count(j) == 1){
                    if(b[x][j]) sz++;
                    else{
                        // cout << x << " " << j << endl;
                        im = 1;
                        break;
                    }
                }
                
            }
            if(im) break;
        }
        // cout << i << " " << a << " " << im << " " << sz << endl;
        if(!im) sz = max(sz, (int) s.size());
    }
    cout << sz << endl;
}


int main(){
    solve();

    return 0;
}

Compilation message

politicaldevelopment.cpp: In function 'void solve()':
politicaldevelopment.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 67 ms 3676 KB Output is correct
4 Correct 135 ms 3800 KB Output is correct
5 Correct 144 ms 3676 KB Output is correct
6 Correct 135 ms 3676 KB Output is correct
7 Correct 130 ms 3676 KB Output is correct
8 Correct 72 ms 3672 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 76 ms 3820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 67 ms 3676 KB Output is correct
4 Correct 135 ms 3800 KB Output is correct
5 Correct 144 ms 3676 KB Output is correct
6 Correct 135 ms 3676 KB Output is correct
7 Correct 130 ms 3676 KB Output is correct
8 Correct 72 ms 3672 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 76 ms 3820 KB Output is correct
11 Correct 133 ms 3672 KB Output is correct
12 Correct 135 ms 3676 KB Output is correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 3676 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 67 ms 3676 KB Output is correct
4 Correct 135 ms 3800 KB Output is correct
5 Correct 144 ms 3676 KB Output is correct
6 Correct 135 ms 3676 KB Output is correct
7 Correct 130 ms 3676 KB Output is correct
8 Correct 72 ms 3672 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 76 ms 3820 KB Output is correct
11 Correct 133 ms 3672 KB Output is correct
12 Correct 135 ms 3676 KB Output is correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 67 ms 3676 KB Output is correct
4 Correct 135 ms 3800 KB Output is correct
5 Correct 144 ms 3676 KB Output is correct
6 Correct 135 ms 3676 KB Output is correct
7 Correct 130 ms 3676 KB Output is correct
8 Correct 72 ms 3672 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 76 ms 3820 KB Output is correct
11 Correct 133 ms 3672 KB Output is correct
12 Correct 135 ms 3676 KB Output is correct
13 Incorrect 0 ms 348 KB Output isn't correct
14 Halted 0 ms 0 KB -