# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1115891 | vjudge1 | Political Development (BOI17_politicaldevelopment) | C++17 | 652 ms | 333040 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.
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define pll pair<long long, long long>
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
const ll N = 1e6 + 100;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll block = 1e3;
bitset<50005>b[50005], cur;
ll n,k;
void to_thic_cau(){
cin >> n >> k;
vector<vector<ll>>prv;
for(ll i = 0; i < n;i++){
prv.pb({i});
ll sz; cin >> sz;
while(sz--){
ll v; cin >> v;
b[min(i, v)][max(i, v)] = 1;
}
}
for(int i = 2; i <= k + 1;i++){
vector<vector<ll>>nxt;
for(auto vec : prv){
cur = b[vec[0]];
for(int j = 1; j < vec.size();j++) cur &= b[vec[j]];
for(int j = cur._Find_first(); j < n; j = cur._Find_next(j)){
vector<ll>tmp = vec;
tmp.pb(j);
nxt.pb(tmp);
}
}
prv.clear(); prv = nxt;
if(!prv.size()){
cout << i - 1 << "\n";
return;
}
}
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int tc = 1;
//cin >> tc;
while(tc--) to_thic_cau();
}
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... |