Submission #864533

#TimeUsernameProblemLanguageResultExecution timeMemory
864533iskhakkutbilimPolitical Development (BOI17_politicaldevelopment)C++17
39 / 100
3095 ms314280 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define all(a) a.begin(), a.end() const int N = 50000; int n, k; int deg[N]; vector<int> g[N]; bitset<N> yes[N]; bool can(vector<int>&v){ for(int i = 0;i < v.size(); i++){ for(int j = i +1;j < v.size(); j++){ if(yes[v[i]][v[j]] == 0) return false; } } return true; } main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; for(int i = 0;i < n; i++){ int sz; cin >> sz; deg[i] = sz; for(int j = 0;j < sz; j++){ int x; cin >> x; yes[i][x] = 1; // if(i < x) g[i].push_back(x); } } int ans = 1; for(int mask = 0; mask < (1<<k); mask++){ for(int i = 0;i < n; i++){ // if(deg[i] < __builtin_popcount(mask)) continue; vector<int> v; for(int j = 0;j < g[i].size(); j++){ if(mask & (1<<j)){ v.push_back(g[i][j]); } } if(can(v)){ ans = max(ans, (int)v.size() + 1); } } } cout << ans; return 0; }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'bool can(std::vector<int>&)':
politicaldevelopment.cpp:14:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i = 0;i < v.size(); i++){
      |                ~~^~~~~~~~~~
politicaldevelopment.cpp:15:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   for(int j = i +1;j < v.size(); j++){
      |                    ~~^~~~~~~~~~
politicaldevelopment.cpp: At global scope:
politicaldevelopment.cpp:23:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   23 | main(){
      | ^~~~
politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:42:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |    for(int j = 0;j < g[i].size(); j++){
      |                  ~~^~~~~~~~~~~~~
#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...