Submission #244615

#TimeUsernameProblemLanguageResultExecution timeMemory
244615kimbj0709Political Development (BOI17_politicaldevelopment)C++14
0 / 100
7 ms3072 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define maxn 50050 int32_t main(){ ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); int no_of_people,k; int no_of_input1; int input; cin >> no_of_people >> k; vector<unordered_set<int> > adj(maxn); bool can2 = 0; for(int i=0;i<no_of_people;i++){ cin >> no_of_input1; for(int j=0;j<no_of_input1;j++){ cin >> input; adj[i].insert(input); } } int ans = 1; for(int i=0;i<no_of_people;i++){ for(int j=0;j<pow(2,adj[i].size());j++){ vector<int> temp; if(__builtin_popcount(j)>=k){ continue; } int cnt = 0; for(auto kk:adj[i]){ if(j&(1<<cnt)){ temp.push_back(kk); } cnt++; } temp.push_back(i); for(int a=0;a<temp.size();a++){ for(int b=0;b<temp.size();b++){ if(a==b){ continue; } if(adj[a].count(b)==0){ goto cont; } } } ans = max(ans,(int)temp.size()); cont : ; } } cout << min(k,ans); }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'int32_t main()':
politicaldevelopment.cpp:36:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int a=0;a<temp.size();a++){
                         ~^~~~~~~~~~~~
politicaldevelopment.cpp:37:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for(int b=0;b<temp.size();b++){
                             ~^~~~~~~~~~~~
politicaldevelopment.cpp:13:10: warning: unused variable 'can2' [-Wunused-variable]
     bool can2 = 0;
          ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...