답안 #472579

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472579 2021-09-13T18:24:21 Z ZaZo_ Political Development (BOI17_politicaldevelopment) C++14
16 / 100
3000 ms 47492 KB
#include <bits/stdc++.h>
#define ZAZO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
using namespace std;
vector<int>edges[50001];
int vis[50001]={0};
map<pair<int,int>,int>ed;
int mx=1,n,k;
int32_t main() {
  ZAZO
  cin >> n >> k ;
  for(int i = 0 ; i < n ; i ++)
  {
    int d;
    cin>>d;
    for(int j = 0 ; j < d ; j ++)
    {
      mx=2;
      int x; cin>>x;
      edges[i].push_back(x);
      edges[x].push_back(i);
      ed[{i,x}]=1;
      ed[{x,i}]=1;
    }
  }
  for(int i = 0 ; i < n ; i ++)
  {
    for(int j = 0 ; j < edges[i].size() ; j ++)
    {
      for(int p = j+1 ; p < edges[i].size(); p++)
      {
        int flg=0;
        int p1 = edges[i][j] , p2 = edges[i][p];
        if(ed.count({p1,p2}))
        {
          mx=max(mx,3ll);
          flg=1;
        }
        if(!flg||mx>=k) continue;
        for(int o = p+1 ; o < edges[i].size(); o++)
        {
          int flg1=0,p3 = edges[i][o];
          if(ed.count({p3,p2})&&ed.count({p3,p1}))
          {
            mx=max(mx,4ll);
            flg1=1;
          }
          if(!flg1||mx>=k) continue;
          for(int kk = o+1 ; kk<edges[i].size() ; kk++)
          {
            int flg2=0,p4 = edges[i][kk];
            if(ed.count({p4,p3})&&ed.count({p4,p2})&&ed.count({p4,p1}))
            {
              cout<<"5"<<endl;
              return 0;
            }
          }
        }
      }
    }
  }
  cout<<mx<<endl;
}

Compilation message

politicaldevelopment.cpp: In function 'int32_t main()':
politicaldevelopment.cpp:28:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int j = 0 ; j < edges[i].size() ; j ++)
      |                     ~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:30:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |       for(int p = j+1 ; p < edges[i].size(); p++)
      |                         ~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:40:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for(int o = p+1 ; o < edges[i].size(); o++)
      |                           ~~^~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:49:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |           for(int kk = o+1 ; kk<edges[i].size() ; kk++)
      |                              ~~^~~~~~~~~~~~~~~~
politicaldevelopment.cpp:51:17: warning: unused variable 'flg2' [-Wunused-variable]
   51 |             int flg2=0,p4 = edges[i][kk];
      |                 ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1484 KB Output is correct
2 Correct 1 ms 1484 KB Output is correct
3 Correct 13 ms 2388 KB Output is correct
4 Correct 1370 ms 2412 KB Output is correct
5 Correct 1505 ms 2412 KB Output is correct
6 Correct 32 ms 2380 KB Output is correct
7 Correct 32 ms 2380 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 2 ms 1484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1484 KB Output is correct
2 Correct 1 ms 1484 KB Output is correct
3 Correct 13 ms 2388 KB Output is correct
4 Correct 1370 ms 2412 KB Output is correct
5 Correct 1505 ms 2412 KB Output is correct
6 Correct 32 ms 2380 KB Output is correct
7 Correct 32 ms 2380 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 2 ms 1484 KB Output is correct
11 Correct 1398 ms 2428 KB Output is correct
12 Correct 1434 ms 2412 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 1573 ms 2412 KB Output is correct
15 Correct 1 ms 1484 KB Output is correct
16 Correct 34 ms 2380 KB Output is correct
17 Correct 1 ms 1484 KB Output is correct
18 Correct 33 ms 2380 KB Output is correct
19 Correct 2 ms 1484 KB Output is correct
20 Correct 6 ms 1868 KB Output is correct
21 Correct 5 ms 1868 KB Output is correct
22 Correct 1 ms 1484 KB Output is correct
23 Correct 16 ms 2508 KB Output is correct
24 Correct 2 ms 1484 KB Output is correct
25 Correct 16 ms 2616 KB Output is correct
26 Correct 15 ms 2508 KB Output is correct
27 Correct 11 ms 2408 KB Output is correct
28 Correct 15 ms 2512 KB Output is correct
29 Correct 11 ms 2348 KB Output is correct
30 Correct 342 ms 2676 KB Output is correct
31 Correct 20 ms 2636 KB Output is correct
32 Correct 350 ms 2680 KB Output is correct
33 Correct 17 ms 2636 KB Output is correct
34 Correct 17 ms 2636 KB Output is correct
35 Correct 9 ms 2080 KB Output is correct
36 Correct 9 ms 1996 KB Output is correct
37 Correct 8 ms 2092 KB Output is correct
38 Correct 11 ms 1876 KB Output is correct
39 Correct 11 ms 1868 KB Output is correct
40 Correct 33 ms 3148 KB Output is correct
41 Correct 11 ms 1924 KB Output is correct
42 Correct 33 ms 3252 KB Output is correct
43 Correct 34 ms 3148 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1484 KB Output is correct
2 Correct 1 ms 1484 KB Output is correct
3 Correct 1 ms 1484 KB Output is correct
4 Correct 1 ms 1484 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1484 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1970 ms 47492 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Incorrect 783 ms 47396 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1484 KB Output is correct
2 Correct 1 ms 1484 KB Output is correct
3 Correct 13 ms 2388 KB Output is correct
4 Correct 1370 ms 2412 KB Output is correct
5 Correct 1505 ms 2412 KB Output is correct
6 Correct 32 ms 2380 KB Output is correct
7 Correct 32 ms 2380 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 2 ms 1484 KB Output is correct
11 Correct 1398 ms 2428 KB Output is correct
12 Correct 1434 ms 2412 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 1573 ms 2412 KB Output is correct
15 Correct 1 ms 1484 KB Output is correct
16 Correct 34 ms 2380 KB Output is correct
17 Correct 1 ms 1484 KB Output is correct
18 Correct 33 ms 2380 KB Output is correct
19 Correct 2 ms 1484 KB Output is correct
20 Correct 6 ms 1868 KB Output is correct
21 Correct 5 ms 1868 KB Output is correct
22 Correct 1 ms 1484 KB Output is correct
23 Correct 16 ms 2508 KB Output is correct
24 Correct 2 ms 1484 KB Output is correct
25 Correct 16 ms 2616 KB Output is correct
26 Correct 15 ms 2508 KB Output is correct
27 Correct 11 ms 2408 KB Output is correct
28 Correct 15 ms 2512 KB Output is correct
29 Correct 11 ms 2348 KB Output is correct
30 Correct 342 ms 2676 KB Output is correct
31 Correct 20 ms 2636 KB Output is correct
32 Correct 350 ms 2680 KB Output is correct
33 Correct 17 ms 2636 KB Output is correct
34 Correct 17 ms 2636 KB Output is correct
35 Correct 9 ms 2080 KB Output is correct
36 Correct 9 ms 1996 KB Output is correct
37 Correct 8 ms 2092 KB Output is correct
38 Correct 11 ms 1876 KB Output is correct
39 Correct 11 ms 1868 KB Output is correct
40 Correct 33 ms 3148 KB Output is correct
41 Correct 11 ms 1924 KB Output is correct
42 Correct 33 ms 3252 KB Output is correct
43 Correct 34 ms 3148 KB Output is correct
44 Incorrect 29 ms 4812 KB Output isn't correct
45 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1484 KB Output is correct
2 Correct 1 ms 1484 KB Output is correct
3 Correct 13 ms 2388 KB Output is correct
4 Correct 1370 ms 2412 KB Output is correct
5 Correct 1505 ms 2412 KB Output is correct
6 Correct 32 ms 2380 KB Output is correct
7 Correct 32 ms 2380 KB Output is correct
8 Correct 1 ms 1484 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 2 ms 1484 KB Output is correct
11 Correct 1398 ms 2428 KB Output is correct
12 Correct 1434 ms 2412 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 1573 ms 2412 KB Output is correct
15 Correct 1 ms 1484 KB Output is correct
16 Correct 34 ms 2380 KB Output is correct
17 Correct 1 ms 1484 KB Output is correct
18 Correct 33 ms 2380 KB Output is correct
19 Correct 2 ms 1484 KB Output is correct
20 Correct 6 ms 1868 KB Output is correct
21 Correct 5 ms 1868 KB Output is correct
22 Correct 1 ms 1484 KB Output is correct
23 Correct 16 ms 2508 KB Output is correct
24 Correct 2 ms 1484 KB Output is correct
25 Correct 16 ms 2616 KB Output is correct
26 Correct 15 ms 2508 KB Output is correct
27 Correct 11 ms 2408 KB Output is correct
28 Correct 15 ms 2512 KB Output is correct
29 Correct 11 ms 2348 KB Output is correct
30 Correct 342 ms 2676 KB Output is correct
31 Correct 20 ms 2636 KB Output is correct
32 Correct 350 ms 2680 KB Output is correct
33 Correct 17 ms 2636 KB Output is correct
34 Correct 17 ms 2636 KB Output is correct
35 Correct 9 ms 2080 KB Output is correct
36 Correct 9 ms 1996 KB Output is correct
37 Correct 8 ms 2092 KB Output is correct
38 Correct 11 ms 1876 KB Output is correct
39 Correct 11 ms 1868 KB Output is correct
40 Correct 33 ms 3148 KB Output is correct
41 Correct 11 ms 1924 KB Output is correct
42 Correct 33 ms 3252 KB Output is correct
43 Correct 34 ms 3148 KB Output is correct
44 Correct 1 ms 1484 KB Output is correct
45 Correct 1098 ms 28272 KB Output is correct
46 Execution timed out 3073 ms 15160 KB Time limit exceeded
47 Halted 0 ms 0 KB -