# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1116087 | vjudge1 | Political Development (BOI17_politicaldevelopment) | C++17 | 664 ms | 319048 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>
#define ll long long
#define ld long double
#define el cout << '\n'
#define f1(i,n) for(int i=1;i<=n;i++)
#define __file_name ""
using namespace std;
const ll maxn = 1e6+5, inf=1e18;
int n, k, ans;
bitset<50000> bit[50000], xx;
queue<vector<int>> qu;
vector<int> cur;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
if(fopen(__file_name ".inp", "r")){
freopen(__file_name ".inp","r",stdin);
freopen(__file_name ".out","w",stdout);
}
// code here
cin >> n >> k;
for(int i=0;i<n;i++){
int d, v; cin >> d;
f1(_, d) {
cin >> v;
if(i < v) bit[i][v] = 1;
}
}
for(int i=0;i<n;i++) qu.push({i});
while(!qu.empty()){
ans = max(ans, (int)qu.front().size());
cur = qu.front();
qu.pop();
xx = bit[cur.back()];
for(int item: cur){
xx &= bit[item];
}
int ii = xx._Find_first();
while(ii < 50000){
cur.push_back(ii);
qu.push(cur);
cur.pop_back();
ii = xx._Find_next(ii);
}
}
cout << ans;
return 0;
}
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... |