# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1115915 | kustizus | Political Development (BOI17_politicaldevelopment) | C++17 | 2349 ms | 524288 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |