답안 #169358

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169358 2019-12-20T05:29:40 Z gabrielpessoa Political Development (BOI17_politicaldevelopment) C++14
16 / 100
3000 ms 14980 KB
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> ii;

const int ms = 4e5+5;

vector<int> g[ms];
int cur[ms];
int z = 0;

main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  int maxS = 0;
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    maxS = max(maxS, d);
    g[i].resize(d);
    for(int j = 0; j < d; j++) {
      cin >> g[i][j];
    }
  }
  int ans = 1;
  if(maxS <= 10) {
    for(int i = 0; i < n; i++) {
      int t = g[i].size();
      for(int j = 0; j < (1 << t); j++) {
        vector<int> v = {i};
        for(int k = 0; k < t; k++) {
          if(j & (1 << k)) v.push_back(g[i][k]);
        }
        ++z;
        for(int k : v) {
          cur[k] = z;
        }
        bool possible = true;
        for(int k : v) {
          int cnt = 0;
          for(int l : g[k]) if(cur[l] == z) cnt++;
          if(cnt != v.size() -1) possible = false;
        }
        if(possible) ans = max(ans, (int) v.size());
      }
    }
  } else if(n <= 5000 && k <= 3) {
    for(int i = 0; i < n; i++) {
      if(g[i].size() > 0) ans = max(ans, 2);
      set<int> s;
      for(int j : g[i]) {
        for(int k : g[j]) {
          if(s.count(k)) ans = max(ans, 3);
        }
        s.insert(j);
      }
    }
  } 
  cout << ans << '\n';
}

Compilation message

politicaldevelopment.cpp:12:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:43:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
           if(cnt != v.size() -1) possible = false;
              ~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 13 ms 9848 KB Output is correct
4 Correct 36 ms 10104 KB Output is correct
5 Correct 39 ms 10204 KB Output is correct
6 Correct 15 ms 9976 KB Output is correct
7 Correct 16 ms 9976 KB Output is correct
8 Correct 11 ms 9684 KB Output is correct
9 Correct 10 ms 9720 KB Output is correct
10 Correct 11 ms 9720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 13 ms 9848 KB Output is correct
4 Correct 36 ms 10104 KB Output is correct
5 Correct 39 ms 10204 KB Output is correct
6 Correct 15 ms 9976 KB Output is correct
7 Correct 16 ms 9976 KB Output is correct
8 Correct 11 ms 9684 KB Output is correct
9 Correct 10 ms 9720 KB Output is correct
10 Correct 11 ms 9720 KB Output is correct
11 Correct 35 ms 10232 KB Output is correct
12 Correct 35 ms 10104 KB Output is correct
13 Correct 10 ms 9720 KB Output is correct
14 Correct 36 ms 10232 KB Output is correct
15 Correct 10 ms 9720 KB Output is correct
16 Correct 13 ms 9976 KB Output is correct
17 Correct 10 ms 9720 KB Output is correct
18 Correct 13 ms 9848 KB Output is correct
19 Correct 10 ms 9720 KB Output is correct
20 Correct 12 ms 9976 KB Output is correct
21 Correct 12 ms 9976 KB Output is correct
22 Correct 10 ms 9720 KB Output is correct
23 Correct 22 ms 9848 KB Output is correct
24 Correct 10 ms 9720 KB Output is correct
25 Correct 23 ms 9976 KB Output is correct
26 Correct 21 ms 9976 KB Output is correct
27 Correct 13 ms 9980 KB Output is correct
28 Correct 20 ms 9948 KB Output is correct
29 Correct 14 ms 9976 KB Output is correct
30 Correct 19 ms 10104 KB Output is correct
31 Correct 20 ms 9976 KB Output is correct
32 Correct 19 ms 9976 KB Output is correct
33 Correct 19 ms 9848 KB Output is correct
34 Correct 19 ms 9848 KB Output is correct
35 Correct 15 ms 9768 KB Output is correct
36 Correct 15 ms 9848 KB Output is correct
37 Correct 14 ms 9848 KB Output is correct
38 Correct 11 ms 9848 KB Output is correct
39 Correct 12 ms 9848 KB Output is correct
40 Correct 16 ms 9976 KB Output is correct
41 Correct 11 ms 9720 KB Output is correct
42 Correct 16 ms 9848 KB Output is correct
43 Correct 16 ms 9848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 9848 KB Output is correct
2 Correct 12 ms 9724 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 10 ms 9720 KB Output is correct
5 Correct 10 ms 9676 KB Output is correct
6 Correct 10 ms 9720 KB Output is correct
7 Correct 11 ms 9720 KB Output is correct
8 Correct 13 ms 9720 KB Output is correct
9 Correct 12 ms 9848 KB Output is correct
10 Correct 10 ms 9720 KB Output is correct
11 Execution timed out 3060 ms 14980 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 13 ms 9848 KB Output is correct
4 Correct 36 ms 10104 KB Output is correct
5 Correct 39 ms 10204 KB Output is correct
6 Correct 15 ms 9976 KB Output is correct
7 Correct 16 ms 9976 KB Output is correct
8 Correct 11 ms 9684 KB Output is correct
9 Correct 10 ms 9720 KB Output is correct
10 Correct 11 ms 9720 KB Output is correct
11 Correct 35 ms 10232 KB Output is correct
12 Correct 35 ms 10104 KB Output is correct
13 Correct 10 ms 9720 KB Output is correct
14 Correct 36 ms 10232 KB Output is correct
15 Correct 10 ms 9720 KB Output is correct
16 Correct 13 ms 9976 KB Output is correct
17 Correct 10 ms 9720 KB Output is correct
18 Correct 13 ms 9848 KB Output is correct
19 Correct 10 ms 9720 KB Output is correct
20 Correct 12 ms 9976 KB Output is correct
21 Correct 12 ms 9976 KB Output is correct
22 Correct 10 ms 9720 KB Output is correct
23 Correct 22 ms 9848 KB Output is correct
24 Correct 10 ms 9720 KB Output is correct
25 Correct 23 ms 9976 KB Output is correct
26 Correct 21 ms 9976 KB Output is correct
27 Correct 13 ms 9980 KB Output is correct
28 Correct 20 ms 9948 KB Output is correct
29 Correct 14 ms 9976 KB Output is correct
30 Correct 19 ms 10104 KB Output is correct
31 Correct 20 ms 9976 KB Output is correct
32 Correct 19 ms 9976 KB Output is correct
33 Correct 19 ms 9848 KB Output is correct
34 Correct 19 ms 9848 KB Output is correct
35 Correct 15 ms 9768 KB Output is correct
36 Correct 15 ms 9848 KB Output is correct
37 Correct 14 ms 9848 KB Output is correct
38 Correct 11 ms 9848 KB Output is correct
39 Correct 12 ms 9848 KB Output is correct
40 Correct 16 ms 9976 KB Output is correct
41 Correct 11 ms 9720 KB Output is correct
42 Correct 16 ms 9848 KB Output is correct
43 Correct 16 ms 9848 KB Output is correct
44 Correct 594 ms 9976 KB Output is correct
45 Correct 11 ms 9848 KB Output is correct
46 Incorrect 13 ms 9976 KB Output isn't correct
47 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 13 ms 9848 KB Output is correct
4 Correct 36 ms 10104 KB Output is correct
5 Correct 39 ms 10204 KB Output is correct
6 Correct 15 ms 9976 KB Output is correct
7 Correct 16 ms 9976 KB Output is correct
8 Correct 11 ms 9684 KB Output is correct
9 Correct 10 ms 9720 KB Output is correct
10 Correct 11 ms 9720 KB Output is correct
11 Correct 35 ms 10232 KB Output is correct
12 Correct 35 ms 10104 KB Output is correct
13 Correct 10 ms 9720 KB Output is correct
14 Correct 36 ms 10232 KB Output is correct
15 Correct 10 ms 9720 KB Output is correct
16 Correct 13 ms 9976 KB Output is correct
17 Correct 10 ms 9720 KB Output is correct
18 Correct 13 ms 9848 KB Output is correct
19 Correct 10 ms 9720 KB Output is correct
20 Correct 12 ms 9976 KB Output is correct
21 Correct 12 ms 9976 KB Output is correct
22 Correct 10 ms 9720 KB Output is correct
23 Correct 22 ms 9848 KB Output is correct
24 Correct 10 ms 9720 KB Output is correct
25 Correct 23 ms 9976 KB Output is correct
26 Correct 21 ms 9976 KB Output is correct
27 Correct 13 ms 9980 KB Output is correct
28 Correct 20 ms 9948 KB Output is correct
29 Correct 14 ms 9976 KB Output is correct
30 Correct 19 ms 10104 KB Output is correct
31 Correct 20 ms 9976 KB Output is correct
32 Correct 19 ms 9976 KB Output is correct
33 Correct 19 ms 9848 KB Output is correct
34 Correct 19 ms 9848 KB Output is correct
35 Correct 15 ms 9768 KB Output is correct
36 Correct 15 ms 9848 KB Output is correct
37 Correct 14 ms 9848 KB Output is correct
38 Correct 11 ms 9848 KB Output is correct
39 Correct 12 ms 9848 KB Output is correct
40 Correct 16 ms 9976 KB Output is correct
41 Correct 11 ms 9720 KB Output is correct
42 Correct 16 ms 9848 KB Output is correct
43 Correct 16 ms 9848 KB Output is correct
44 Correct 10 ms 9720 KB Output is correct
45 Incorrect 51 ms 11644 KB Output isn't correct
46 Halted 0 ms 0 KB -