답안 #1014171

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1014171 2024-07-04T13:28:50 Z 12345678 Council (JOI23_council) C++17
40 / 100
3838 ms 29520 KB
#include <bits/stdc++.h>

using namespace std;

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

#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';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Runtime error 2 ms 604 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Runtime error 2 ms 604 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 54 ms 22036 KB Output is correct
3 Correct 40 ms 22096 KB Output is correct
4 Correct 28 ms 21596 KB Output is correct
5 Correct 42 ms 22104 KB Output is correct
6 Correct 31 ms 21584 KB Output is correct
7 Correct 42 ms 22096 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 352 KB Output is correct
11 Correct 0 ms 352 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 352 KB Output is correct
14 Correct 0 ms 352 KB Output is correct
15 Correct 0 ms 360 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 54 ms 22036 KB Output is correct
3 Correct 40 ms 22096 KB Output is correct
4 Correct 28 ms 21596 KB Output is correct
5 Correct 42 ms 22104 KB Output is correct
6 Correct 31 ms 21584 KB Output is correct
7 Correct 42 ms 22096 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 352 KB Output is correct
11 Correct 0 ms 352 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 352 KB Output is correct
14 Correct 0 ms 352 KB Output is correct
15 Correct 0 ms 360 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 310 ms 26620 KB Output is correct
21 Correct 246 ms 26040 KB Output is correct
22 Correct 198 ms 26092 KB Output is correct
23 Correct 254 ms 27032 KB Output is correct
24 Correct 250 ms 26756 KB Output is correct
25 Correct 367 ms 27008 KB Output is correct
26 Correct 380 ms 26692 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 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 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 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 54 ms 22036 KB Output is correct
3 Correct 40 ms 22096 KB Output is correct
4 Correct 28 ms 21596 KB Output is correct
5 Correct 42 ms 22104 KB Output is correct
6 Correct 31 ms 21584 KB Output is correct
7 Correct 42 ms 22096 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 352 KB Output is correct
11 Correct 0 ms 352 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 352 KB Output is correct
14 Correct 0 ms 352 KB Output is correct
15 Correct 0 ms 360 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 310 ms 26620 KB Output is correct
21 Correct 246 ms 26040 KB Output is correct
22 Correct 198 ms 26092 KB Output is correct
23 Correct 254 ms 27032 KB Output is correct
24 Correct 250 ms 26756 KB Output is correct
25 Correct 367 ms 27008 KB Output is correct
26 Correct 380 ms 26692 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 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 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 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 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 352 KB Output is correct
47 Correct 2779 ms 29244 KB Output is correct
48 Correct 1439 ms 28508 KB Output is correct
49 Correct 1354 ms 28440 KB Output is correct
50 Correct 2289 ms 29520 KB Output is correct
51 Correct 2312 ms 29184 KB Output is correct
52 Correct 3651 ms 29064 KB Output is correct
53 Correct 3838 ms 29340 KB Output is correct
54 Correct 1 ms 344 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 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 54 ms 22036 KB Output is correct
3 Correct 40 ms 22096 KB Output is correct
4 Correct 28 ms 21596 KB Output is correct
5 Correct 42 ms 22104 KB Output is correct
6 Correct 31 ms 21584 KB Output is correct
7 Correct 42 ms 22096 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 352 KB Output is correct
11 Correct 0 ms 352 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 352 KB Output is correct
14 Correct 0 ms 352 KB Output is correct
15 Correct 0 ms 360 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 310 ms 26620 KB Output is correct
21 Correct 246 ms 26040 KB Output is correct
22 Correct 198 ms 26092 KB Output is correct
23 Correct 254 ms 27032 KB Output is correct
24 Correct 250 ms 26756 KB Output is correct
25 Correct 367 ms 27008 KB Output is correct
26 Correct 380 ms 26692 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 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 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 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 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 352 KB Output is correct
47 Correct 2779 ms 29244 KB Output is correct
48 Correct 1439 ms 28508 KB Output is correct
49 Correct 1354 ms 28440 KB Output is correct
50 Correct 2289 ms 29520 KB Output is correct
51 Correct 2312 ms 29184 KB Output is correct
52 Correct 3651 ms 29064 KB Output is correct
53 Correct 3838 ms 29340 KB Output is correct
54 Correct 1 ms 344 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 0 ms 348 KB Output is correct
59 Runtime error 5 ms 860 KB Execution killed with signal 11
60 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Runtime error 2 ms 604 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -