답안 #934891

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934891 2024-02-28T06:28:32 Z irmuun Political Development (BOI17_politicaldevelopment) C++17
4 / 100
158 ms 310640 KB
#include<bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

ll n,k,d[50000];
vector<ll>adj[50000];
vector<vector<bool>>dis(50000,vector<bool>(50000,0));
bool check(vector<ll>v){
    for(ll i=0;i<v.size();i++){
        for(ll j=i+1;j<v.size();j++){
            if(dis[i][j]==false){
                return false;
            }
        }
    }
    return true;
}
 
int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n>>k;
    bool ok=false;
    for(ll i=0;i<n;i++){
        cin>>d[i];
        if(d[i]>0) ok=true;
        adj[i].resize(d[i]);
        for(ll j=0;j<d[i];j++){
            cin>>adj[i][j];
            dis[i][adj[i][j]]=true;
        }
    }
    bool k3=false;
    ll ans=1;
    for(ll i=0;i<n;i++){
        if(d[i]<=10){
            ll sz=d[i];
            ll p=(1ll<<sz);
            vector<ll>v;
            for(ll j=0;j<p;j++){
                for(ll r=0;r<sz;r++){
                    if(j&(1ll<<r)){
                        v.pb(adj[i][r]);
                    }
                }
                if(check(v)){
                    ans=max(ans,(ll)v.size()+1);
                }
            }
        }
    }
    cout<<ans;
}

Compilation message

politicaldevelopment.cpp: In function 'bool check(std::vector<long long int>)':
politicaldevelopment.cpp:16:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(ll i=0;i<v.size();i++){
      |                ~^~~~~~~~~
politicaldevelopment.cpp:17:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(ll j=i+1;j<v.size();j++){
      |                      ~^~~~~~~~~
politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:29:10: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
   29 |     bool ok=false;
      |          ^~
politicaldevelopment.cpp:39:10: warning: unused variable 'k3' [-Wunused-variable]
   39 |     bool k3=false;
      |          ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 310356 KB Output is correct
2 Correct 142 ms 310340 KB Output is correct
3 Correct 147 ms 310640 KB Output is correct
4 Correct 142 ms 310520 KB Output is correct
5 Correct 149 ms 310612 KB Output is correct
6 Correct 145 ms 310612 KB Output is correct
7 Correct 143 ms 310612 KB Output is correct
8 Correct 141 ms 310360 KB Output is correct
9 Correct 138 ms 310380 KB Output is correct
10 Correct 140 ms 310352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 310356 KB Output is correct
2 Correct 142 ms 310340 KB Output is correct
3 Correct 147 ms 310640 KB Output is correct
4 Correct 142 ms 310520 KB Output is correct
5 Correct 149 ms 310612 KB Output is correct
6 Correct 145 ms 310612 KB Output is correct
7 Correct 143 ms 310612 KB Output is correct
8 Correct 141 ms 310360 KB Output is correct
9 Correct 138 ms 310380 KB Output is correct
10 Correct 140 ms 310352 KB Output is correct
11 Correct 146 ms 310612 KB Output is correct
12 Correct 140 ms 310612 KB Output is correct
13 Incorrect 158 ms 310352 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 140 ms 310348 KB Output is correct
2 Correct 144 ms 310408 KB Output is correct
3 Correct 139 ms 310324 KB Output is correct
4 Incorrect 139 ms 310432 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 310356 KB Output is correct
2 Correct 142 ms 310340 KB Output is correct
3 Correct 147 ms 310640 KB Output is correct
4 Correct 142 ms 310520 KB Output is correct
5 Correct 149 ms 310612 KB Output is correct
6 Correct 145 ms 310612 KB Output is correct
7 Correct 143 ms 310612 KB Output is correct
8 Correct 141 ms 310360 KB Output is correct
9 Correct 138 ms 310380 KB Output is correct
10 Correct 140 ms 310352 KB Output is correct
11 Correct 146 ms 310612 KB Output is correct
12 Correct 140 ms 310612 KB Output is correct
13 Incorrect 158 ms 310352 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 141 ms 310356 KB Output is correct
2 Correct 142 ms 310340 KB Output is correct
3 Correct 147 ms 310640 KB Output is correct
4 Correct 142 ms 310520 KB Output is correct
5 Correct 149 ms 310612 KB Output is correct
6 Correct 145 ms 310612 KB Output is correct
7 Correct 143 ms 310612 KB Output is correct
8 Correct 141 ms 310360 KB Output is correct
9 Correct 138 ms 310380 KB Output is correct
10 Correct 140 ms 310352 KB Output is correct
11 Correct 146 ms 310612 KB Output is correct
12 Correct 140 ms 310612 KB Output is correct
13 Incorrect 158 ms 310352 KB Output isn't correct
14 Halted 0 ms 0 KB -