Submission #1079477

#TimeUsernameProblemLanguageResultExecution timeMemory
1079477andrei_iorgulescuPolitical Development (BOI17_politicaldevelopment)C++14
4 / 100
11 ms26716 KiB
#include <bits/stdc++.h> using namespace std; int n,k; bitset<50005> bs[50005]; vector<int> g[50005]; int deg[50005]; bool luat[50005]; int cn; vector<int> o; bool iau[15]; int ans = 1; void afis() { for (int i = 0; i < o.size(); i++) for (int j = i + 1; j < o.size(); j++) if (iau[i] and iau[j] and !bs[o[i]][o[j]]) return; ans = max(ans, 1 + (int)o.size()); } void bkt(int pos) { if (pos == o.size()) afis(); else { iau[pos] = false; bkt(pos + 1); iau[pos] = true; bkt(pos + 1); } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> k; for (int i = 0; i < n; i++) { int cati; cin >> cati; while (cati--) { int x; cin >> x; g[i].push_back(x); bs[i][x] = 1; } } set<pair<int,int>> cmn; for (int i = 0; i < n; i++) { deg[i] = g[i].size(); cmn.insert({deg[i], i}); } while (!cmn.empty()) { pair<int,int> pr = *cmn.begin(); cmn.erase(pr); luat[pr.second] = true; for (auto vec : g[pr.second]) { if (!luat[vec]) { cmn.erase({deg[vec], vec}); deg[vec]--; cmn.insert({deg[vec], vec}); } } vector<int> oameni; for (auto it : g[pr.second]) if (!luat[it]) oameni.push_back(it); o = oameni; cn = pr.second; bkt(0); } cout << ans; return 0; }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'void afis()':
politicaldevelopment.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |     for (int i = 0; i < o.size(); i++)
      |                     ~~^~~~~~~~~~
politicaldevelopment.cpp:18:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for (int j = i + 1; j < o.size(); j++)
      |                             ~~^~~~~~~~~~
politicaldevelopment.cpp: In function 'void bkt(int)':
politicaldevelopment.cpp:26:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     if (pos == o.size())
      |         ~~~~^~~~~~~~~~~
#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...