이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std ;
const int N = 3e5 ;
int n, m, a[N + 1], kol[20], cnt[(1 << 20)] ;
signed main()
{
ios_base::sync_with_stdio( 0 ) ;
cin.tie( 0 ) ;
cout.tie( 0 ) ;
cin >> n >> m ;
for(int i = 1 ; i <= n ; i++)
{
for(int j = 0 ; j < m ; j++)
{
bool c ;
cin >> c ;
if(c)
{
kol[j]++ ;
a[i] ^= (1 << j) ;
}
}
cnt[a[i]]++ ;
}
for(int i = 1 ; i <= n ; i++)
{
int ans = 0 ;
for(int j = 0 ; j < m ; j++)
if((1 << j) & a[i])
kol[j]-- ;
cnt[a[i]]-- ;
for(int j = 0 ; j < (1 << m) ; j++)
{
if(!cnt[j])
continue ;
int now = 0 ;
for(int q = 0 ; q < m ; q++)
if(((1 << q) & j))
{
if((n - 2) / 2 < kol[q] - 1)
now++ ;
}
else
{
if((n - 2) / 2 < kol[q])
now++ ;
}
ans = max(ans, now) ;
}
cnt[a[i]]++ ;
for(int j = 0 ; j < m ; j++)
if((1 << j) & a[i])
kol[j]++ ;
cout << ans << '\n' ;
}
return 0 ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |