# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
721146 | 2023-04-10T11:25:43 Z | ktkerem | Political Development (BOI17_politicaldevelopment) | C++17 | 495 ms | 66644 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[2050]; 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; //std::cout << a.fi << " " << a.sec << "\n"; //std::cout << vv[0] << "\n"; 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5028 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 8 ms | 6064 KB | Output is correct |
4 | Correct | 8 ms | 6192 KB | Output is correct |
5 | Correct | 8 ms | 6100 KB | Output is correct |
6 | Correct | 9 ms | 6192 KB | Output is correct |
7 | Correct | 8 ms | 6244 KB | Output is correct |
8 | Correct | 5 ms | 5284 KB | Output is correct |
9 | Correct | 3 ms | 5028 KB | Output is correct |
10 | Correct | 5 ms | 5204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5028 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 8 ms | 6064 KB | Output is correct |
4 | Correct | 8 ms | 6192 KB | Output is correct |
5 | Correct | 8 ms | 6100 KB | Output is correct |
6 | Correct | 9 ms | 6192 KB | Output is correct |
7 | Correct | 8 ms | 6244 KB | Output is correct |
8 | Correct | 5 ms | 5284 KB | Output is correct |
9 | Correct | 3 ms | 5028 KB | Output is correct |
10 | Correct | 5 ms | 5204 KB | Output is correct |
11 | Correct | 8 ms | 6100 KB | Output is correct |
12 | Correct | 9 ms | 6188 KB | Output is correct |
13 | Correct | 3 ms | 4948 KB | Output is correct |
14 | Correct | 8 ms | 6100 KB | Output is correct |
15 | Correct | 3 ms | 5024 KB | Output is correct |
16 | Correct | 8 ms | 6192 KB | Output is correct |
17 | Correct | 3 ms | 4948 KB | Output is correct |
18 | Correct | 8 ms | 6228 KB | Output is correct |
19 | Correct | 5 ms | 5292 KB | Output is correct |
20 | Correct | 7 ms | 5808 KB | Output is correct |
21 | Correct | 6 ms | 5844 KB | Output is correct |
22 | Correct | 6 ms | 5204 KB | Output is correct |
23 | Correct | 9 ms | 6192 KB | Output is correct |
24 | Correct | 5 ms | 5204 KB | Output is correct |
25 | Correct | 9 ms | 6304 KB | Output is correct |
26 | Correct | 8 ms | 6100 KB | Output is correct |
27 | Correct | 11 ms | 6228 KB | Output is correct |
28 | Correct | 9 ms | 6184 KB | Output is correct |
29 | Correct | 8 ms | 6100 KB | Output is correct |
30 | Correct | 9 ms | 6324 KB | Output is correct |
31 | Correct | 9 ms | 6228 KB | Output is correct |
32 | Correct | 10 ms | 6356 KB | Output is correct |
33 | Incorrect | 13 ms | 6280 KB | Output isn't correct |
34 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5204 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 3 ms | 4948 KB | Output is correct |
4 | Correct | 3 ms | 5036 KB | Output is correct |
5 | Correct | 3 ms | 4948 KB | Output is correct |
6 | Correct | 3 ms | 5024 KB | Output is correct |
7 | Correct | 3 ms | 5048 KB | Output is correct |
8 | Correct | 5 ms | 5024 KB | Output is correct |
9 | Correct | 5 ms | 5028 KB | Output is correct |
10 | Correct | 4 ms | 5032 KB | Output is correct |
11 | Correct | 475 ms | 66552 KB | Output is correct |
12 | Correct | 3 ms | 5024 KB | Output is correct |
13 | Correct | 495 ms | 66508 KB | Output is correct |
14 | Correct | 3 ms | 4948 KB | Output is correct |
15 | Correct | 478 ms | 66496 KB | Output is correct |
16 | Correct | 459 ms | 66508 KB | Output is correct |
17 | Correct | 494 ms | 66644 KB | Output is correct |
18 | Correct | 482 ms | 66508 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5028 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 8 ms | 6064 KB | Output is correct |
4 | Correct | 8 ms | 6192 KB | Output is correct |
5 | Correct | 8 ms | 6100 KB | Output is correct |
6 | Correct | 9 ms | 6192 KB | Output is correct |
7 | Correct | 8 ms | 6244 KB | Output is correct |
8 | Correct | 5 ms | 5284 KB | Output is correct |
9 | Correct | 3 ms | 5028 KB | Output is correct |
10 | Correct | 5 ms | 5204 KB | Output is correct |
11 | Correct | 8 ms | 6100 KB | Output is correct |
12 | Correct | 9 ms | 6188 KB | Output is correct |
13 | Correct | 3 ms | 4948 KB | Output is correct |
14 | Correct | 8 ms | 6100 KB | Output is correct |
15 | Correct | 3 ms | 5024 KB | Output is correct |
16 | Correct | 8 ms | 6192 KB | Output is correct |
17 | Correct | 3 ms | 4948 KB | Output is correct |
18 | Correct | 8 ms | 6228 KB | Output is correct |
19 | Correct | 5 ms | 5292 KB | Output is correct |
20 | Correct | 7 ms | 5808 KB | Output is correct |
21 | Correct | 6 ms | 5844 KB | Output is correct |
22 | Correct | 6 ms | 5204 KB | Output is correct |
23 | Correct | 9 ms | 6192 KB | Output is correct |
24 | Correct | 5 ms | 5204 KB | Output is correct |
25 | Correct | 9 ms | 6304 KB | Output is correct |
26 | Correct | 8 ms | 6100 KB | Output is correct |
27 | Correct | 11 ms | 6228 KB | Output is correct |
28 | Correct | 9 ms | 6184 KB | Output is correct |
29 | Correct | 8 ms | 6100 KB | Output is correct |
30 | Correct | 9 ms | 6324 KB | Output is correct |
31 | Correct | 9 ms | 6228 KB | Output is correct |
32 | Correct | 10 ms | 6356 KB | Output is correct |
33 | Incorrect | 13 ms | 6280 KB | Output isn't correct |
34 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5028 KB | Output is correct |
2 | Correct | 3 ms | 4948 KB | Output is correct |
3 | Correct | 8 ms | 6064 KB | Output is correct |
4 | Correct | 8 ms | 6192 KB | Output is correct |
5 | Correct | 8 ms | 6100 KB | Output is correct |
6 | Correct | 9 ms | 6192 KB | Output is correct |
7 | Correct | 8 ms | 6244 KB | Output is correct |
8 | Correct | 5 ms | 5284 KB | Output is correct |
9 | Correct | 3 ms | 5028 KB | Output is correct |
10 | Correct | 5 ms | 5204 KB | Output is correct |
11 | Correct | 8 ms | 6100 KB | Output is correct |
12 | Correct | 9 ms | 6188 KB | Output is correct |
13 | Correct | 3 ms | 4948 KB | Output is correct |
14 | Correct | 8 ms | 6100 KB | Output is correct |
15 | Correct | 3 ms | 5024 KB | Output is correct |
16 | Correct | 8 ms | 6192 KB | Output is correct |
17 | Correct | 3 ms | 4948 KB | Output is correct |
18 | Correct | 8 ms | 6228 KB | Output is correct |
19 | Correct | 5 ms | 5292 KB | Output is correct |
20 | Correct | 7 ms | 5808 KB | Output is correct |
21 | Correct | 6 ms | 5844 KB | Output is correct |
22 | Correct | 6 ms | 5204 KB | Output is correct |
23 | Correct | 9 ms | 6192 KB | Output is correct |
24 | Correct | 5 ms | 5204 KB | Output is correct |
25 | Correct | 9 ms | 6304 KB | Output is correct |
26 | Correct | 8 ms | 6100 KB | Output is correct |
27 | Correct | 11 ms | 6228 KB | Output is correct |
28 | Correct | 9 ms | 6184 KB | Output is correct |
29 | Correct | 8 ms | 6100 KB | Output is correct |
30 | Correct | 9 ms | 6324 KB | Output is correct |
31 | Correct | 9 ms | 6228 KB | Output is correct |
32 | Correct | 10 ms | 6356 KB | Output is correct |
33 | Incorrect | 13 ms | 6280 KB | Output isn't correct |
34 | Halted | 0 ms | 0 KB | - |