답안 #1115850

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115850 2024-11-21T02:47:20 Z Thanhs Political Development (BOI17_politicaldevelopment) C++17
54 / 100
3000 ms 33172 KB
#include <bits/stdc++.h>
using namespace std;

#define name "TENBAI"
#define fi first
#define se second
#define int long long
#define endl '\n'
#define setmin(x, y) x = min((x), (y))
#define setmax(x, y) x = max((x), (y))
#define sqr(x) ((x) * (x))

mt19937 hdp(chrono::high_resolution_clock::now().time_since_epoch().count());
int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);}

const int NM = 5e4 + 5;

int ans = 1, n, k;
bitset<NM> g;

void solve()
{
    cin >> n >> k;
    vector<vector<int>> v;
    for (int i = 0; i < n; i++)
    {
        g.reset();
        int t;
        cin >> t;
        while (t--)
        {
            int x;
            cin >> x;
            g[x] = 1;
        }
        for (int k = v.size(), j = 0; j < k; j++)
        {
            bool sus = 0;
            for (int x : v[j])
                if (!g[x])
                    sus = 1;
            if (!sus)
            {
                v.push_back(v[j]);
                v.back().push_back(i);
                setmax(ans, (int)v.back().size());
            }
        }
        v.push_back(vector<int>(1, i));
    }
    cout << ans;
}

signed main()
{
    if (fopen("in.txt", "r")) 
    {
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    }
    else if (fopen(name".inp", "r"))
    {
        freopen(name".inp", "r", stdin);
        freopen(name".out", "w", stdout);
    }
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int tc = 1; 
    // cin >> tc;
    while (tc--)
        solve();
}

Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:58:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |         freopen("in.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:59:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 |         freopen("out.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:63:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |         freopen(name".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
politicaldevelopment.cpp:64:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   64 |         freopen(name".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 49 ms 928 KB Output is correct
4 Correct 50 ms 1096 KB Output is correct
5 Correct 49 ms 1104 KB Output is correct
6 Correct 46 ms 1084 KB Output is correct
7 Correct 47 ms 1104 KB Output is correct
8 Correct 21 ms 732 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 22 ms 800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 49 ms 928 KB Output is correct
4 Correct 50 ms 1096 KB Output is correct
5 Correct 49 ms 1104 KB Output is correct
6 Correct 46 ms 1084 KB Output is correct
7 Correct 47 ms 1104 KB Output is correct
8 Correct 21 ms 732 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 22 ms 800 KB Output is correct
11 Correct 50 ms 1096 KB Output is correct
12 Correct 50 ms 1096 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 45 ms 1116 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 47 ms 1096 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 59 ms 1116 KB Output is correct
19 Correct 21 ms 692 KB Output is correct
20 Correct 39 ms 840 KB Output is correct
21 Correct 36 ms 856 KB Output is correct
22 Correct 28 ms 592 KB Output is correct
23 Correct 78 ms 1068 KB Output is correct
24 Correct 23 ms 592 KB Output is correct
25 Correct 59 ms 1096 KB Output is correct
26 Correct 60 ms 1096 KB Output is correct
27 Correct 47 ms 1104 KB Output is correct
28 Correct 51 ms 1276 KB Output is correct
29 Correct 46 ms 1096 KB Output is correct
30 Correct 63 ms 1096 KB Output is correct
31 Correct 56 ms 1124 KB Output is correct
32 Correct 62 ms 1096 KB Output is correct
33 Correct 63 ms 1096 KB Output is correct
34 Correct 58 ms 1272 KB Output is correct
35 Correct 15 ms 592 KB Output is correct
36 Correct 14 ms 668 KB Output is correct
37 Correct 15 ms 804 KB Output is correct
38 Correct 6 ms 592 KB Output is correct
39 Correct 6 ms 592 KB Output is correct
40 Correct 96 ms 1200 KB Output is correct
41 Correct 5 ms 592 KB Output is correct
42 Correct 97 ms 1084 KB Output is correct
43 Correct 92 ms 1156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 592 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 508 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 568 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Execution timed out 3069 ms 5884 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 49 ms 928 KB Output is correct
4 Correct 50 ms 1096 KB Output is correct
5 Correct 49 ms 1104 KB Output is correct
6 Correct 46 ms 1084 KB Output is correct
7 Correct 47 ms 1104 KB Output is correct
8 Correct 21 ms 732 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 22 ms 800 KB Output is correct
11 Correct 50 ms 1096 KB Output is correct
12 Correct 50 ms 1096 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 45 ms 1116 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 47 ms 1096 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 59 ms 1116 KB Output is correct
19 Correct 21 ms 692 KB Output is correct
20 Correct 39 ms 840 KB Output is correct
21 Correct 36 ms 856 KB Output is correct
22 Correct 28 ms 592 KB Output is correct
23 Correct 78 ms 1068 KB Output is correct
24 Correct 23 ms 592 KB Output is correct
25 Correct 59 ms 1096 KB Output is correct
26 Correct 60 ms 1096 KB Output is correct
27 Correct 47 ms 1104 KB Output is correct
28 Correct 51 ms 1276 KB Output is correct
29 Correct 46 ms 1096 KB Output is correct
30 Correct 63 ms 1096 KB Output is correct
31 Correct 56 ms 1124 KB Output is correct
32 Correct 62 ms 1096 KB Output is correct
33 Correct 63 ms 1096 KB Output is correct
34 Correct 58 ms 1272 KB Output is correct
35 Correct 15 ms 592 KB Output is correct
36 Correct 14 ms 668 KB Output is correct
37 Correct 15 ms 804 KB Output is correct
38 Correct 6 ms 592 KB Output is correct
39 Correct 6 ms 592 KB Output is correct
40 Correct 96 ms 1200 KB Output is correct
41 Correct 5 ms 592 KB Output is correct
42 Correct 97 ms 1084 KB Output is correct
43 Correct 92 ms 1156 KB Output is correct
44 Correct 1340 ms 33172 KB Output is correct
45 Correct 1 ms 336 KB Output is correct
46 Correct 88 ms 1176 KB Output is correct
47 Correct 158 ms 1792 KB Output is correct
48 Correct 93 ms 1240 KB Output is correct
49 Correct 150 ms 1792 KB Output is correct
50 Correct 147 ms 1744 KB Output is correct
51 Correct 293 ms 3072 KB Output is correct
52 Correct 51 ms 920 KB Output is correct
53 Correct 207 ms 3172 KB Output is correct
54 Correct 317 ms 3836 KB Output is correct
55 Correct 44 ms 1096 KB Output is correct
56 Correct 51 ms 1096 KB Output is correct
57 Correct 29 ms 660 KB Output is correct
58 Correct 207 ms 3068 KB Output is correct
59 Correct 152 ms 2304 KB Output is correct
60 Correct 45 ms 1104 KB Output is correct
61 Correct 148 ms 2336 KB Output is correct
62 Correct 150 ms 2304 KB Output is correct
63 Correct 1334 ms 33052 KB Output is correct
64 Correct 737 ms 15552 KB Output is correct
65 Correct 77 ms 1156 KB Output is correct
66 Correct 156 ms 2528 KB Output is correct
67 Correct 488 ms 8436 KB Output is correct
68 Correct 731 ms 15664 KB Output is correct
69 Correct 77 ms 1156 KB Output is correct
70 Correct 192 ms 2320 KB Output is correct
71 Correct 495 ms 8260 KB Output is correct
72 Correct 334 ms 5116 KB Output is correct
73 Correct 46 ms 1096 KB Output is correct
74 Correct 183 ms 2380 KB Output is correct
75 Correct 343 ms 5088 KB Output is correct
76 Correct 82 ms 1668 KB Output is correct
77 Correct 182 ms 2816 KB Output is correct
78 Correct 46 ms 1064 KB Output is correct
79 Correct 44 ms 1668 KB Output is correct
80 Correct 107 ms 1668 KB Output is correct
81 Correct 182 ms 2816 KB Output is correct
82 Correct 5 ms 592 KB Output is correct
83 Correct 45 ms 1584 KB Output is correct
84 Correct 151 ms 1796 KB Output is correct
85 Correct 5 ms 592 KB Output is correct
86 Correct 152 ms 1912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 49 ms 928 KB Output is correct
4 Correct 50 ms 1096 KB Output is correct
5 Correct 49 ms 1104 KB Output is correct
6 Correct 46 ms 1084 KB Output is correct
7 Correct 47 ms 1104 KB Output is correct
8 Correct 21 ms 732 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 22 ms 800 KB Output is correct
11 Correct 50 ms 1096 KB Output is correct
12 Correct 50 ms 1096 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 45 ms 1116 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 47 ms 1096 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 59 ms 1116 KB Output is correct
19 Correct 21 ms 692 KB Output is correct
20 Correct 39 ms 840 KB Output is correct
21 Correct 36 ms 856 KB Output is correct
22 Correct 28 ms 592 KB Output is correct
23 Correct 78 ms 1068 KB Output is correct
24 Correct 23 ms 592 KB Output is correct
25 Correct 59 ms 1096 KB Output is correct
26 Correct 60 ms 1096 KB Output is correct
27 Correct 47 ms 1104 KB Output is correct
28 Correct 51 ms 1276 KB Output is correct
29 Correct 46 ms 1096 KB Output is correct
30 Correct 63 ms 1096 KB Output is correct
31 Correct 56 ms 1124 KB Output is correct
32 Correct 62 ms 1096 KB Output is correct
33 Correct 63 ms 1096 KB Output is correct
34 Correct 58 ms 1272 KB Output is correct
35 Correct 15 ms 592 KB Output is correct
36 Correct 14 ms 668 KB Output is correct
37 Correct 15 ms 804 KB Output is correct
38 Correct 6 ms 592 KB Output is correct
39 Correct 6 ms 592 KB Output is correct
40 Correct 96 ms 1200 KB Output is correct
41 Correct 5 ms 592 KB Output is correct
42 Correct 97 ms 1084 KB Output is correct
43 Correct 92 ms 1156 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Execution timed out 3094 ms 5924 KB Time limit exceeded
46 Halted 0 ms 0 KB -