Submission #1115914

#TimeUsernameProblemLanguageResultExecution timeMemory
1115914kustizusPolitical Development (BOI17_politicaldevelopment)C++17
62 / 100
2451 ms524288 KiB
#pragma GCC optimize("Ofast" , "unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define all(v) v.begin(), v.end() #define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define read_input(file) if (fopen(file".inp", "r")) freopen(file".inp", "r", stdin); #define file(file) freopen (file".inp", "r", stdin); freopen (file".out", "w", stdout); const int N = 5e4; int n, k; bitset <N + 5> g[N + 5]; vector <vector<int>> c[11]; void solve(){ cin >> n >> k; for (int i = 0; i < n; ++i){ int d; cin >> d; while (d--){ int x; cin >> x; g[i][x] = 1; } c[1].push_back({i}); } bitset <N + 5> b; int pos = 1; while (true){ for (vector <int> v : c[pos]){ bool ok = false; for (int x : v){ if (!ok){ ok = true; b = g[x]; } else b &= g[x]; } for (int j = b._Find_first(); j < n; j = b._Find_next(j)){ vector <int> nxt = v; nxt.push_back(j); c[pos + 1].push_back(nxt); } } ++pos; if (c[pos].empty()) break; } --pos; cout << pos; } signed main(){ faster; // file("file"); read_input("file"); int tt = 1; // cin >> tt; while (tt--){ solve(); } }

Compilation message (stderr)

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:10:61: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 | #define read_input(file) if (fopen(file".inp", "r")) freopen(file".inp", "r", stdin);
      |                                                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:58:5: note: in expansion of macro 'read_input'
   58 |     read_input("file");
      |     ^~~~~~~~~~
#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...