Submission #721149

# Submission time Handle Problem Language Result Execution time Memory
721149 2023-04-10T11:31:34 Z ktkerem Political Development (BOI17_politicaldevelopment) C++17
27 / 100
699 ms 57024 KB
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
#include<bits/stdc++.h>
typedef int ll;
typedef long double ld;
typedef __int128 vll;
typedef long long ftyp;
typedef std::complex<ftyp> vec;
#define llll std::pair<ll , ll>
#define pb push_back
#define fi first
#define sec second
#define cx real
#define cy imag
#define all(a) a.begin() , a.end()
#define debug std::cout << "!!ALERT ALERT!!" << std::endl;  
const ll limit = 1e9+7;
const ll sus = 5e4+5;
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
ll n , k;
std::vector<ll> adj[sus] , v[sus];
std::map<ll , ll> mp[sus];
std::set<llll> st;
ll dlt[sus] , dd[sus] , ist[4080];
void solve(){
  std::cin >> n >> k;
  for(ll i = 0 ; n>i;i++){
    ll d;std::cin >> d;
    dd[i] = d;
    for(ll j = 0;d>j;j++){
      ll x;std::cin >> x;
      adj[i].pb(x);
      v[x].pb(i);
      mp[i][x] = 1;
    }
    st.insert({dd[i] , i});
  }
  ll ans = 1;
  while(!st.empty()){
    llll a = *st.begin();
    st.erase(st.begin());
    std::vector<ll> vv;
    dlt[a.sec] = 1;
    for(auto j:adj[a.sec]){
      if(dlt[j] == 0){
        vv.pb(j);
      }
    }
    ll o = vv.size();
    memset(ist , 0 , sizeof(ist));
    ist[0] = 1;
    for(auto j:v[a.sec]){
      if(dlt[j] == 1){
        continue;
      }
      st.erase(st.find({dd[j] , j}));
      dd[j]--;
      st.insert({dd[j] , j});
    }
    if(o > 12){
      while(1){
        debug;
      }
    }
    for(ll i = 1;(1ll << o) > i;i++){
      ll ff = (1ll << std::__lg(i)) ^ i;
      //std::cout << i << " " << ff << " " << vv[std::__lg(i)] << " " << a.sec << "\n";
      if(ist[ff] == 0 || mp[vv[std::__lg(i)]][a.sec] == 0){
        continue;
      }
      ll kd = 1;
      for(ll j = 0;o>j;j++){
        if(((ff & (1ll << j)) && (mp[vv[j]][vv[std::__lg(i)]] == 0)) && (vv[std::__lg(i)] != j)){
          kd = 0;
          break;
        }
      }
      //std::cout << i << " " << kd << " " << ff << "\n";
      ist[i] = kd;
      if(kd){
        ans = std::max(ans , __builtin_popcount(i) + 1);
      }
    }
  }
  std::cout << ans << "\n";
  return;/**/
}
int main(){
  std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);
  ll t = 1;
  //std::cin >> t;
  while(t--){
    solve();
  }
}

Compilation message

politicaldevelopment.cpp:5:78: warning: "/*" within comment [-Wcomment]
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
      |
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 10 ms 6100 KB Output is correct
4 Correct 9 ms 6140 KB Output is correct
5 Correct 10 ms 6160 KB Output is correct
6 Correct 10 ms 6100 KB Output is correct
7 Correct 10 ms 6100 KB Output is correct
8 Correct 5 ms 5204 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 5 ms 5204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 10 ms 6100 KB Output is correct
4 Correct 9 ms 6140 KB Output is correct
5 Correct 10 ms 6160 KB Output is correct
6 Correct 10 ms 6100 KB Output is correct
7 Correct 10 ms 6100 KB Output is correct
8 Correct 5 ms 5204 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 5 ms 5204 KB Output is correct
11 Correct 9 ms 6132 KB Output is correct
12 Correct 10 ms 6152 KB Output is correct
13 Correct 3 ms 4948 KB Output is correct
14 Correct 10 ms 6144 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 12 ms 6100 KB Output is correct
17 Correct 3 ms 4948 KB Output is correct
18 Correct 11 ms 6100 KB Output is correct
19 Correct 8 ms 5308 KB Output is correct
20 Correct 10 ms 5868 KB Output is correct
21 Correct 8 ms 5844 KB Output is correct
22 Correct 6 ms 5204 KB Output is correct
23 Correct 13 ms 6204 KB Output is correct
24 Correct 5 ms 5204 KB Output is correct
25 Correct 12 ms 6228 KB Output is correct
26 Correct 11 ms 6168 KB Output is correct
27 Correct 10 ms 6100 KB Output is correct
28 Correct 14 ms 6100 KB Output is correct
29 Correct 9 ms 6012 KB Output is correct
30 Correct 12 ms 6228 KB Output is correct
31 Correct 11 ms 6228 KB Output is correct
32 Correct 12 ms 6228 KB Output is correct
33 Incorrect 13 ms 6180 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 5204 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 4 ms 4948 KB Output is correct
4 Correct 2 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 3 ms 4948 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 3 ms 4948 KB Output is correct
9 Correct 4 ms 4948 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 673 ms 56968 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 599 ms 56844 KB Output is correct
14 Correct 2 ms 4948 KB Output is correct
15 Correct 631 ms 56880 KB Output is correct
16 Correct 608 ms 56816 KB Output is correct
17 Correct 649 ms 57024 KB Output is correct
18 Correct 699 ms 56776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 10 ms 6100 KB Output is correct
4 Correct 9 ms 6140 KB Output is correct
5 Correct 10 ms 6160 KB Output is correct
6 Correct 10 ms 6100 KB Output is correct
7 Correct 10 ms 6100 KB Output is correct
8 Correct 5 ms 5204 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 5 ms 5204 KB Output is correct
11 Correct 9 ms 6132 KB Output is correct
12 Correct 10 ms 6152 KB Output is correct
13 Correct 3 ms 4948 KB Output is correct
14 Correct 10 ms 6144 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 12 ms 6100 KB Output is correct
17 Correct 3 ms 4948 KB Output is correct
18 Correct 11 ms 6100 KB Output is correct
19 Correct 8 ms 5308 KB Output is correct
20 Correct 10 ms 5868 KB Output is correct
21 Correct 8 ms 5844 KB Output is correct
22 Correct 6 ms 5204 KB Output is correct
23 Correct 13 ms 6204 KB Output is correct
24 Correct 5 ms 5204 KB Output is correct
25 Correct 12 ms 6228 KB Output is correct
26 Correct 11 ms 6168 KB Output is correct
27 Correct 10 ms 6100 KB Output is correct
28 Correct 14 ms 6100 KB Output is correct
29 Correct 9 ms 6012 KB Output is correct
30 Correct 12 ms 6228 KB Output is correct
31 Correct 11 ms 6228 KB Output is correct
32 Correct 12 ms 6228 KB Output is correct
33 Incorrect 13 ms 6180 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 10 ms 6100 KB Output is correct
4 Correct 9 ms 6140 KB Output is correct
5 Correct 10 ms 6160 KB Output is correct
6 Correct 10 ms 6100 KB Output is correct
7 Correct 10 ms 6100 KB Output is correct
8 Correct 5 ms 5204 KB Output is correct
9 Correct 3 ms 4948 KB Output is correct
10 Correct 5 ms 5204 KB Output is correct
11 Correct 9 ms 6132 KB Output is correct
12 Correct 10 ms 6152 KB Output is correct
13 Correct 3 ms 4948 KB Output is correct
14 Correct 10 ms 6144 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 12 ms 6100 KB Output is correct
17 Correct 3 ms 4948 KB Output is correct
18 Correct 11 ms 6100 KB Output is correct
19 Correct 8 ms 5308 KB Output is correct
20 Correct 10 ms 5868 KB Output is correct
21 Correct 8 ms 5844 KB Output is correct
22 Correct 6 ms 5204 KB Output is correct
23 Correct 13 ms 6204 KB Output is correct
24 Correct 5 ms 5204 KB Output is correct
25 Correct 12 ms 6228 KB Output is correct
26 Correct 11 ms 6168 KB Output is correct
27 Correct 10 ms 6100 KB Output is correct
28 Correct 14 ms 6100 KB Output is correct
29 Correct 9 ms 6012 KB Output is correct
30 Correct 12 ms 6228 KB Output is correct
31 Correct 11 ms 6228 KB Output is correct
32 Correct 12 ms 6228 KB Output is correct
33 Incorrect 13 ms 6180 KB Output isn't correct
34 Halted 0 ms 0 KB -