# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
481040 | DJeniUp | Political Development (BOI17_politicaldevelopment) | C++17 | 3067 ms | 7648 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("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pairll;
typedef pair<ll,pairll>pairlll;
typedef pair<pairll,pairll>pairllll;
typedef long double ld;
typedef pair<ll,string>pairls;
#define INF 1000000000000007
#define MOD 1000000007
#define pb push_back
#define fr first
#define sc second
#define endl '\n'
ll n,k,f[50007],res;
vector<ll>v[50007];
void S(ll x,ll y){
if(x==n+1){
res=max(res,y);
return ;
}
if(f[x]==y){
for(int i=0;i<v[x].size();i++){
f[v[x][i]]++;
}
S(x+1,y+1);
for(int i=0;i<v[x].size();i++){
f[v[x][i]]--;
}
}
S(x+1,y);
return ;
}
int main() {
cin>>n>>k;
res=0;
for(int i=1;i<=n;i++){
ll x;
cin>>x;
for(int j=1;j<=x;j++){
ll y;
cin>>y;
y++;
if(y>i)v[i].pb(y);
}
}
S(1,0);
cout<<res<<endl;
}
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... |