Submission #1014172

# Submission time Handle Problem Language Result Execution time Memory
1014172 2024-07-04T13:29:30 Z 12345678 Council (JOI23_council) C++17
56 / 100
4000 ms 34588 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=3e5+5, mx=20;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

int n, m, sm[mx], a[nx][mx], msk[nx], cnt[(1<<mx)+5], res[nx];

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>m;
    for (int i=1; i<=n; i++) for (int j=0; j<m; j++) cin>>a[i][j], sm[j]+=a[i][j], msk[i]+=(1-a[i][j])*(1<<j);
    for (int i=1; i<=n; i++) cnt[msk[i]]++;
    for (int i=1; i<=n; i++)
    {
        cnt[msk[i]]--;
        int vl=0, ans=0;
        for (int j=0; j<m; j++) 
        {
            if (sm[j]-a[i][j]>=(n/2)) ans++;
            if (sm[j]-a[i][j]!=(n/2)) vl+=(1<<j);
        }
        for (int j=0; j<(1<<m); j++) if (cnt[j]) res[i]=max(res[i], ans-(m-__builtin_popcount(j|vl)));
        cnt[msk[i]]++;
    }
    for (int i=1; i<=n;i ++) cout<<res[i]<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 19 ms 348 KB Output is correct
6 Correct 142 ms 512 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 10 ms 572 KB Output is correct
9 Correct 141 ms 1572 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 10 ms 348 KB Output is correct
12 Correct 144 ms 1544 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 352 KB Output is correct
16 Correct 0 ms 352 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 480 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 468 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 356 KB Output is correct
27 Correct 0 ms 352 KB Output is correct
28 Correct 0 ms 352 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 352 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 356 KB Output is correct
34 Correct 0 ms 472 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 356 KB Output is correct
37 Correct 0 ms 608 KB Output is correct
38 Correct 0 ms 356 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 352 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 352 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 3 ms 604 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 2 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 19 ms 348 KB Output is correct
6 Correct 142 ms 512 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 10 ms 572 KB Output is correct
9 Correct 141 ms 1572 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 10 ms 348 KB Output is correct
12 Correct 144 ms 1544 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 352 KB Output is correct
16 Correct 0 ms 352 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 480 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 468 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 356 KB Output is correct
27 Correct 0 ms 352 KB Output is correct
28 Correct 0 ms 352 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 352 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 356 KB Output is correct
34 Correct 0 ms 472 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 356 KB Output is correct
37 Correct 0 ms 608 KB Output is correct
38 Correct 0 ms 356 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 352 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 352 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 3 ms 604 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 2 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 2 ms 348 KB Output is correct
51 Correct 1452 ms 1092 KB Output is correct
52 Correct 1353 ms 852 KB Output is correct
53 Correct 1430 ms 4700 KB Output is correct
54 Correct 1481 ms 4696 KB Output is correct
55 Correct 1 ms 600 KB Output is correct
56 Correct 297 ms 1324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 47 ms 27476 KB Output is correct
3 Correct 44 ms 27636 KB Output is correct
4 Correct 56 ms 27216 KB Output is correct
5 Correct 49 ms 27472 KB Output is correct
6 Correct 41 ms 27228 KB Output is correct
7 Correct 48 ms 27476 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 468 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 47 ms 27476 KB Output is correct
3 Correct 44 ms 27636 KB Output is correct
4 Correct 56 ms 27216 KB Output is correct
5 Correct 49 ms 27472 KB Output is correct
6 Correct 41 ms 27228 KB Output is correct
7 Correct 48 ms 27476 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 468 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 343 ms 30092 KB Output is correct
21 Correct 244 ms 29820 KB Output is correct
22 Correct 231 ms 29520 KB Output is correct
23 Correct 261 ms 30032 KB Output is correct
24 Correct 270 ms 29780 KB Output is correct
25 Correct 390 ms 29804 KB Output is correct
26 Correct 459 ms 29764 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 1 ms 468 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 472 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 47 ms 27476 KB Output is correct
3 Correct 44 ms 27636 KB Output is correct
4 Correct 56 ms 27216 KB Output is correct
5 Correct 49 ms 27472 KB Output is correct
6 Correct 41 ms 27228 KB Output is correct
7 Correct 48 ms 27476 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 468 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 343 ms 30092 KB Output is correct
21 Correct 244 ms 29820 KB Output is correct
22 Correct 231 ms 29520 KB Output is correct
23 Correct 261 ms 30032 KB Output is correct
24 Correct 270 ms 29780 KB Output is correct
25 Correct 390 ms 29804 KB Output is correct
26 Correct 459 ms 29764 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 1 ms 468 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 472 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2902 ms 26708 KB Output is correct
48 Correct 1491 ms 26688 KB Output is correct
49 Correct 1590 ms 26704 KB Output is correct
50 Correct 2320 ms 27088 KB Output is correct
51 Correct 2376 ms 26708 KB Output is correct
52 Correct 3894 ms 26724 KB Output is correct
53 Correct 3994 ms 26964 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 47 ms 27476 KB Output is correct
3 Correct 44 ms 27636 KB Output is correct
4 Correct 56 ms 27216 KB Output is correct
5 Correct 49 ms 27472 KB Output is correct
6 Correct 41 ms 27228 KB Output is correct
7 Correct 48 ms 27476 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 468 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 343 ms 30092 KB Output is correct
21 Correct 244 ms 29820 KB Output is correct
22 Correct 231 ms 29520 KB Output is correct
23 Correct 261 ms 30032 KB Output is correct
24 Correct 270 ms 29780 KB Output is correct
25 Correct 390 ms 29804 KB Output is correct
26 Correct 459 ms 29764 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 1 ms 468 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 472 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2902 ms 26708 KB Output is correct
48 Correct 1491 ms 26688 KB Output is correct
49 Correct 1590 ms 26704 KB Output is correct
50 Correct 2320 ms 27088 KB Output is correct
51 Correct 2376 ms 26708 KB Output is correct
52 Correct 3894 ms 26724 KB Output is correct
53 Correct 3994 ms 26964 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Execution timed out 4051 ms 34588 KB Time limit exceeded
60 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 19 ms 348 KB Output is correct
6 Correct 142 ms 512 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
8 Correct 10 ms 572 KB Output is correct
9 Correct 141 ms 1572 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 10 ms 348 KB Output is correct
12 Correct 144 ms 1544 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 352 KB Output is correct
16 Correct 0 ms 352 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 480 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 468 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 356 KB Output is correct
27 Correct 0 ms 352 KB Output is correct
28 Correct 0 ms 352 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 352 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 356 KB Output is correct
34 Correct 0 ms 472 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 356 KB Output is correct
37 Correct 0 ms 608 KB Output is correct
38 Correct 0 ms 356 KB Output is correct
39 Correct 0 ms 352 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 352 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 1 ms 352 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 3 ms 604 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 2 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 2 ms 348 KB Output is correct
51 Correct 1452 ms 1092 KB Output is correct
52 Correct 1353 ms 852 KB Output is correct
53 Correct 1430 ms 4700 KB Output is correct
54 Correct 1481 ms 4696 KB Output is correct
55 Correct 1 ms 600 KB Output is correct
56 Correct 297 ms 1324 KB Output is correct
57 Correct 0 ms 344 KB Output is correct
58 Correct 47 ms 27476 KB Output is correct
59 Correct 44 ms 27636 KB Output is correct
60 Correct 56 ms 27216 KB Output is correct
61 Correct 49 ms 27472 KB Output is correct
62 Correct 41 ms 27228 KB Output is correct
63 Correct 48 ms 27476 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 0 ms 468 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 1 ms 604 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 343 ms 30092 KB Output is correct
77 Correct 244 ms 29820 KB Output is correct
78 Correct 231 ms 29520 KB Output is correct
79 Correct 261 ms 30032 KB Output is correct
80 Correct 270 ms 29780 KB Output is correct
81 Correct 390 ms 29804 KB Output is correct
82 Correct 459 ms 29764 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 1 ms 344 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 468 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 472 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 2902 ms 26708 KB Output is correct
104 Correct 1491 ms 26688 KB Output is correct
105 Correct 1590 ms 26704 KB Output is correct
106 Correct 2320 ms 27088 KB Output is correct
107 Correct 2376 ms 26708 KB Output is correct
108 Correct 3894 ms 26724 KB Output is correct
109 Correct 3994 ms 26964 KB Output is correct
110 Correct 0 ms 348 KB Output is correct
111 Correct 0 ms 348 KB Output is correct
112 Correct 0 ms 348 KB Output is correct
113 Correct 0 ms 348 KB Output is correct
114 Correct 1 ms 348 KB Output is correct
115 Execution timed out 4051 ms 34588 KB Time limit exceeded
116 Halted 0 ms 0 KB -