# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
924426 | 2024-02-09T03:38:42 Z | Muhammad_Aneeq | Political Development (BOI17_politicaldevelopment) | C++17 | 3000 ms | 24432 KB |
/* بسم الله الرحمن الرحيم Author: (:Muhammad Aneeq:) */ #include <iostream> #include <vector> #include <set> using namespace std; int const N=6e4+10; set<int>nei[N]={}; int res[N]={}; int ans=0; bool valid(vector<int>f) { for (auto i:f) res[i]=0; for (auto i:f) { for (auto j:nei[i]) res[j]++; } bool w=0; for (auto i:f) { if (res[i]!=f.size()-1) { w=1; break; } } return (!w); } void check(int n) { set<int>f=nei[n]; for (int i=0;i<=(1<<f.size());i++) { vector<int>z; auto e=begin(f); for (int j=0;j<f.size();j++) { if ((1<<j)&i) z.push_back(*e); e++; } z.push_back(n); if (valid(z)) { ans=max(ans,int(z.size())); } } } inline void solve() { int n,k; cin>>n>>k; for (int i=0;i<n;i++) { int d; cin>>d; while (d--) { int x; cin>>x; if (i!=x) nei[i].insert(x); } } for (int i=1;i<=n;i++) check(i); cout<<min(ans,k)<<endl; } int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); solve(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3164 KB | Output is correct |
2 | Correct | 1 ms | 3164 KB | Output is correct |
3 | Correct | 18 ms | 3824 KB | Output is correct |
4 | Correct | 186 ms | 3920 KB | Output is correct |
5 | Correct | 190 ms | 3820 KB | Output is correct |
6 | Correct | 19 ms | 3672 KB | Output is correct |
7 | Correct | 18 ms | 3676 KB | Output is correct |
8 | Correct | 2 ms | 3164 KB | Output is correct |
9 | Correct | 1 ms | 3164 KB | Output is correct |
10 | Correct | 2 ms | 3164 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3164 KB | Output is correct |
2 | Correct | 1 ms | 3164 KB | Output is correct |
3 | Correct | 18 ms | 3824 KB | Output is correct |
4 | Correct | 186 ms | 3920 KB | Output is correct |
5 | Correct | 190 ms | 3820 KB | Output is correct |
6 | Correct | 19 ms | 3672 KB | Output is correct |
7 | Correct | 18 ms | 3676 KB | Output is correct |
8 | Correct | 2 ms | 3164 KB | Output is correct |
9 | Correct | 1 ms | 3164 KB | Output is correct |
10 | Correct | 2 ms | 3164 KB | Output is correct |
11 | Correct | 213 ms | 4052 KB | Output is correct |
12 | Correct | 221 ms | 4064 KB | Output is correct |
13 | Correct | 1 ms | 3160 KB | Output is correct |
14 | Correct | 186 ms | 4056 KB | Output is correct |
15 | Correct | 1 ms | 3164 KB | Output is correct |
16 | Correct | 20 ms | 3828 KB | Output is correct |
17 | Correct | 1 ms | 3160 KB | Output is correct |
18 | Correct | 18 ms | 3676 KB | Output is correct |
19 | Correct | 2 ms | 3164 KB | Output is correct |
20 | Correct | 3 ms | 3416 KB | Output is correct |
21 | Correct | 3 ms | 3420 KB | Output is correct |
22 | Correct | 2 ms | 3164 KB | Output is correct |
23 | Correct | 12 ms | 3932 KB | Output is correct |
24 | Correct | 2 ms | 3164 KB | Output is correct |
25 | Correct | 13 ms | 3932 KB | Output is correct |
26 | Correct | 10 ms | 3676 KB | Output is correct |
27 | Correct | 5 ms | 3676 KB | Output is correct |
28 | Correct | 10 ms | 3676 KB | Output is correct |
29 | Correct | 5 ms | 3676 KB | Output is correct |
30 | Correct | 97 ms | 4048 KB | Output is correct |
31 | Correct | 10 ms | 3932 KB | Output is correct |
32 | Correct | 93 ms | 4044 KB | Output is correct |
33 | Correct | 9 ms | 3932 KB | Output is correct |
34 | Correct | 11 ms | 3980 KB | Output is correct |
35 | Correct | 5 ms | 3420 KB | Output is correct |
36 | Correct | 5 ms | 3420 KB | Output is correct |
37 | Correct | 5 ms | 3420 KB | Output is correct |
38 | Execution timed out | 3084 ms | 3420 KB | Time limit exceeded |
39 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3416 KB | Output is correct |
2 | Correct | 1 ms | 3164 KB | Output is correct |
3 | Correct | 1 ms | 3340 KB | Output is correct |
4 | Correct | 1 ms | 3164 KB | Output is correct |
5 | Correct | 1 ms | 3164 KB | Output is correct |
6 | Correct | 1 ms | 3164 KB | Output is correct |
7 | Correct | 1 ms | 3160 KB | Output is correct |
8 | Correct | 1 ms | 3160 KB | Output is correct |
9 | Correct | 1 ms | 3164 KB | Output is correct |
10 | Correct | 1 ms | 3164 KB | Output is correct |
11 | Execution timed out | 3051 ms | 24432 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3164 KB | Output is correct |
2 | Correct | 1 ms | 3164 KB | Output is correct |
3 | Correct | 18 ms | 3824 KB | Output is correct |
4 | Correct | 186 ms | 3920 KB | Output is correct |
5 | Correct | 190 ms | 3820 KB | Output is correct |
6 | Correct | 19 ms | 3672 KB | Output is correct |
7 | Correct | 18 ms | 3676 KB | Output is correct |
8 | Correct | 2 ms | 3164 KB | Output is correct |
9 | Correct | 1 ms | 3164 KB | Output is correct |
10 | Correct | 2 ms | 3164 KB | Output is correct |
11 | Correct | 213 ms | 4052 KB | Output is correct |
12 | Correct | 221 ms | 4064 KB | Output is correct |
13 | Correct | 1 ms | 3160 KB | Output is correct |
14 | Correct | 186 ms | 4056 KB | Output is correct |
15 | Correct | 1 ms | 3164 KB | Output is correct |
16 | Correct | 20 ms | 3828 KB | Output is correct |
17 | Correct | 1 ms | 3160 KB | Output is correct |
18 | Correct | 18 ms | 3676 KB | Output is correct |
19 | Correct | 2 ms | 3164 KB | Output is correct |
20 | Correct | 3 ms | 3416 KB | Output is correct |
21 | Correct | 3 ms | 3420 KB | Output is correct |
22 | Correct | 2 ms | 3164 KB | Output is correct |
23 | Correct | 12 ms | 3932 KB | Output is correct |
24 | Correct | 2 ms | 3164 KB | Output is correct |
25 | Correct | 13 ms | 3932 KB | Output is correct |
26 | Correct | 10 ms | 3676 KB | Output is correct |
27 | Correct | 5 ms | 3676 KB | Output is correct |
28 | Correct | 10 ms | 3676 KB | Output is correct |
29 | Correct | 5 ms | 3676 KB | Output is correct |
30 | Correct | 97 ms | 4048 KB | Output is correct |
31 | Correct | 10 ms | 3932 KB | Output is correct |
32 | Correct | 93 ms | 4044 KB | Output is correct |
33 | Correct | 9 ms | 3932 KB | Output is correct |
34 | Correct | 11 ms | 3980 KB | Output is correct |
35 | Correct | 5 ms | 3420 KB | Output is correct |
36 | Correct | 5 ms | 3420 KB | Output is correct |
37 | Correct | 5 ms | 3420 KB | Output is correct |
38 | Execution timed out | 3084 ms | 3420 KB | Time limit exceeded |
39 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3164 KB | Output is correct |
2 | Correct | 1 ms | 3164 KB | Output is correct |
3 | Correct | 18 ms | 3824 KB | Output is correct |
4 | Correct | 186 ms | 3920 KB | Output is correct |
5 | Correct | 190 ms | 3820 KB | Output is correct |
6 | Correct | 19 ms | 3672 KB | Output is correct |
7 | Correct | 18 ms | 3676 KB | Output is correct |
8 | Correct | 2 ms | 3164 KB | Output is correct |
9 | Correct | 1 ms | 3164 KB | Output is correct |
10 | Correct | 2 ms | 3164 KB | Output is correct |
11 | Correct | 213 ms | 4052 KB | Output is correct |
12 | Correct | 221 ms | 4064 KB | Output is correct |
13 | Correct | 1 ms | 3160 KB | Output is correct |
14 | Correct | 186 ms | 4056 KB | Output is correct |
15 | Correct | 1 ms | 3164 KB | Output is correct |
16 | Correct | 20 ms | 3828 KB | Output is correct |
17 | Correct | 1 ms | 3160 KB | Output is correct |
18 | Correct | 18 ms | 3676 KB | Output is correct |
19 | Correct | 2 ms | 3164 KB | Output is correct |
20 | Correct | 3 ms | 3416 KB | Output is correct |
21 | Correct | 3 ms | 3420 KB | Output is correct |
22 | Correct | 2 ms | 3164 KB | Output is correct |
23 | Correct | 12 ms | 3932 KB | Output is correct |
24 | Correct | 2 ms | 3164 KB | Output is correct |
25 | Correct | 13 ms | 3932 KB | Output is correct |
26 | Correct | 10 ms | 3676 KB | Output is correct |
27 | Correct | 5 ms | 3676 KB | Output is correct |
28 | Correct | 10 ms | 3676 KB | Output is correct |
29 | Correct | 5 ms | 3676 KB | Output is correct |
30 | Correct | 97 ms | 4048 KB | Output is correct |
31 | Correct | 10 ms | 3932 KB | Output is correct |
32 | Correct | 93 ms | 4044 KB | Output is correct |
33 | Correct | 9 ms | 3932 KB | Output is correct |
34 | Correct | 11 ms | 3980 KB | Output is correct |
35 | Correct | 5 ms | 3420 KB | Output is correct |
36 | Correct | 5 ms | 3420 KB | Output is correct |
37 | Correct | 5 ms | 3420 KB | Output is correct |
38 | Execution timed out | 3084 ms | 3420 KB | Time limit exceeded |
39 | Halted | 0 ms | 0 KB | - |