Submission #1115839

#TimeUsernameProblemLanguageResultExecution timeMemory
1115839vjudge1Political Development (BOI17_politicaldevelopment)C++17
100 / 100
776 ms310268 KiB
#include <iostream> #include <bitset> #include <vector> using namespace std; bitset<50005> b[50005], bb; vector<vector<int>> v[11]; vector<int> va; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, res = 1; cin >> n >> k; for (int i = 0; i < n; i++) { int x; cin >> x; for (int j = 0; j < x; j++) { int y; cin >> y; if (y > i) { b[i][y] = 1; v[2].push_back({i, y}); } } } for (int i = 2; i <= k; i++) { if (v[i].empty()) break; res = i; if (i == k) break; for (auto w : v[i]) { bb = b[w[0]]; for (int i = 1; i < w.size(); i++) { bb &= b[w[i]]; } for (int j = bb._Find_first(); j <= n; j = bb._Find_next(j)) { va = w; va.push_back(j); v[i + 1].push_back(va); } } } cout << res; }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:31:31: 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 = 1; i < w.size(); i++) {
      |                             ~~^~~~~~~~~~
#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...