# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
381710 | 2021-03-25T18:17:45 Z | MohamedAhmed04 | Political Development (BOI17_politicaldevelopment) | C++14 | 302 ms | 312684 KB |
#include <bits/stdc++.h> using namespace std ; const int MAX = 5e4 + 10 ; vector<int>v[MAX] ; int n , k ; int ans = 0 ; vector<int>taken ; bitset<MAX>mark[MAX] ; bool check(int x) { for(auto &i : taken) { if(!mark[x][i]) return false ; } return true ; } void solve(vector<int>&v1 , int idx) { if(idx == v1.size()) { ans = max(ans , (int)(taken.size())) ; return ; } if(check(v1[idx])) { taken.push_back(v1[idx]) ; solve(v1 , idx+1) ; taken.pop_back() ; } solve(v1 , idx+1) ; } int main() { ios_base::sync_with_stdio(0) ; cin.tie(0) ; cin>>n>>k ; for(int i = 0 ; i < n ; ++i) { int sz ; cin>>sz ; v[i].resize(sz) ; for(auto &j : v[i]) { cin>>j ; mark[i][j] = 1 ; } } for(int i = 0 ; i < n ; ++i) { if(v[i].size() < k) { taken.push_back(i) ; solve(v[i] , 0) ; taken.pop_back() ; } } return cout<<ans<<"\n" , 0 ; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1516 KB | Output is correct |
2 | Correct | 2 ms | 1516 KB | Output is correct |
3 | Correct | 16 ms | 22636 KB | Output is correct |
4 | Correct | 15 ms | 21868 KB | Output is correct |
5 | Correct | 14 ms | 21868 KB | Output is correct |
6 | Correct | 14 ms | 21868 KB | Output is correct |
7 | Correct | 14 ms | 21868 KB | Output is correct |
8 | Correct | 2 ms | 1516 KB | Output is correct |
9 | Correct | 2 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1516 KB | Output is correct |
2 | Correct | 2 ms | 1516 KB | Output is correct |
3 | Correct | 16 ms | 22636 KB | Output is correct |
4 | Correct | 15 ms | 21868 KB | Output is correct |
5 | Correct | 14 ms | 21868 KB | Output is correct |
6 | Correct | 14 ms | 21868 KB | Output is correct |
7 | Correct | 14 ms | 21868 KB | Output is correct |
8 | Correct | 2 ms | 1516 KB | Output is correct |
9 | Correct | 2 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
11 | Correct | 14 ms | 21868 KB | Output is correct |
12 | Correct | 14 ms | 21868 KB | Output is correct |
13 | Correct | 2 ms | 1516 KB | Output is correct |
14 | Correct | 14 ms | 21868 KB | Output is correct |
15 | Correct | 2 ms | 1516 KB | Output is correct |
16 | Correct | 14 ms | 21868 KB | Output is correct |
17 | Correct | 2 ms | 1516 KB | Output is correct |
18 | Correct | 14 ms | 21868 KB | Output is correct |
19 | Correct | 2 ms | 1516 KB | Output is correct |
20 | Correct | 14 ms | 21740 KB | Output is correct |
21 | Correct | 14 ms | 21740 KB | Output is correct |
22 | Correct | 2 ms | 1536 KB | Output is correct |
23 | Incorrect | 16 ms | 22892 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1516 KB | Output is correct |
2 | Correct | 2 ms | 1644 KB | Output is correct |
3 | Correct | 2 ms | 1644 KB | Output is correct |
4 | Correct | 2 ms | 1516 KB | Output is correct |
5 | Correct | 2 ms | 1644 KB | Output is correct |
6 | Correct | 2 ms | 1644 KB | Output is correct |
7 | Correct | 2 ms | 1644 KB | Output is correct |
8 | Correct | 2 ms | 1644 KB | Output is correct |
9 | Correct | 2 ms | 1644 KB | Output is correct |
10 | Correct | 2 ms | 1664 KB | Output is correct |
11 | Correct | 296 ms | 312556 KB | Output is correct |
12 | Correct | 2 ms | 1644 KB | Output is correct |
13 | Correct | 295 ms | 312540 KB | Output is correct |
14 | Correct | 2 ms | 1644 KB | Output is correct |
15 | Correct | 302 ms | 312556 KB | Output is correct |
16 | Correct | 300 ms | 312556 KB | Output is correct |
17 | Correct | 292 ms | 312556 KB | Output is correct |
18 | Correct | 296 ms | 312684 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1516 KB | Output is correct |
2 | Correct | 2 ms | 1516 KB | Output is correct |
3 | Correct | 16 ms | 22636 KB | Output is correct |
4 | Correct | 15 ms | 21868 KB | Output is correct |
5 | Correct | 14 ms | 21868 KB | Output is correct |
6 | Correct | 14 ms | 21868 KB | Output is correct |
7 | Correct | 14 ms | 21868 KB | Output is correct |
8 | Correct | 2 ms | 1516 KB | Output is correct |
9 | Correct | 2 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
11 | Correct | 14 ms | 21868 KB | Output is correct |
12 | Correct | 14 ms | 21868 KB | Output is correct |
13 | Correct | 2 ms | 1516 KB | Output is correct |
14 | Correct | 14 ms | 21868 KB | Output is correct |
15 | Correct | 2 ms | 1516 KB | Output is correct |
16 | Correct | 14 ms | 21868 KB | Output is correct |
17 | Correct | 2 ms | 1516 KB | Output is correct |
18 | Correct | 14 ms | 21868 KB | Output is correct |
19 | Correct | 2 ms | 1516 KB | Output is correct |
20 | Correct | 14 ms | 21740 KB | Output is correct |
21 | Correct | 14 ms | 21740 KB | Output is correct |
22 | Correct | 2 ms | 1536 KB | Output is correct |
23 | Incorrect | 16 ms | 22892 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1516 KB | Output is correct |
2 | Correct | 2 ms | 1516 KB | Output is correct |
3 | Correct | 16 ms | 22636 KB | Output is correct |
4 | Correct | 15 ms | 21868 KB | Output is correct |
5 | Correct | 14 ms | 21868 KB | Output is correct |
6 | Correct | 14 ms | 21868 KB | Output is correct |
7 | Correct | 14 ms | 21868 KB | Output is correct |
8 | Correct | 2 ms | 1516 KB | Output is correct |
9 | Correct | 2 ms | 1516 KB | Output is correct |
10 | Correct | 2 ms | 1516 KB | Output is correct |
11 | Correct | 14 ms | 21868 KB | Output is correct |
12 | Correct | 14 ms | 21868 KB | Output is correct |
13 | Correct | 2 ms | 1516 KB | Output is correct |
14 | Correct | 14 ms | 21868 KB | Output is correct |
15 | Correct | 2 ms | 1516 KB | Output is correct |
16 | Correct | 14 ms | 21868 KB | Output is correct |
17 | Correct | 2 ms | 1516 KB | Output is correct |
18 | Correct | 14 ms | 21868 KB | Output is correct |
19 | Correct | 2 ms | 1516 KB | Output is correct |
20 | Correct | 14 ms | 21740 KB | Output is correct |
21 | Correct | 14 ms | 21740 KB | Output is correct |
22 | Correct | 2 ms | 1536 KB | Output is correct |
23 | Incorrect | 16 ms | 22892 KB | Output isn't correct |
24 | Halted | 0 ms | 0 KB | - |