Submission #891742

#TimeUsernameProblemLanguageResultExecution timeMemory
891742alexander707070Council (JOI23_council)C++14
16 / 100
4078 ms32144 KiB
#include<bits/stdc++.h> #define MAXN 300007 using namespace std; int n,m,br[25],curr; int a[MAXN],s[MAXN][25],res,ans; int 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 f=1;f<=m;f++){ cin>>s[i][f]; a[i]*=2; a[i]+=s[i][f]; br[f]+=s[i][f]; } } for(int i=1;i<=n;i++){ for(int f=1;f<=m;f++)br[f]-=s[i][f]; curr=res=0; for(int f=1;f<=m;f++){ curr*=2; if(br[f]==n/2)curr++; if(br[f]>=n/2)res++; } ans=0; for(int f=1;f<=n;f++){ if(f!=i)ans=max(ans,res-__builtin_popcount(curr&a[f])); } cout<<ans<<"\n"; for(int f=1;f<=m;f++)br[f]+=s[i][f]; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...