Submission #1077500

#TimeUsernameProblemLanguageResultExecution timeMemory
1077500vjudge1Council (JOI23_council)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt //#define int long long #define ll long long typedef unsigned long long ull; using namespace std; const int N=3e5+5,M=1030; int a[N],n,m,f[20],b[M]; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n>>m; for (int i=1;i<=n;i++){ for (int j=0;j<m;j++){ bool x;cin>>x; if (x) a[i]|=(1<<j),f[j]++; } b[a[i]]++; } for (int i=1;i<=n;i++){ for (int j=0;j<m;j++) if (a[i]&(1<<j)) f[j]--; b[a[i]]--; int ans=0,x=0; for (int j=0;j<m;j++) x+=(f[j]>=n/2); for (int j=0;j<M;j++){ if (!b[j]) continue; int y=x; for (int k=0;k<m;k++) if ((j&(1<<j)) && f[k]==n/2) y--; ans=max(ans,y); } for (int j=0;j<m;j++) if (a[i]&(1<<j)) f[j]++; b[a[i]]++; cout<<ans<<endl; } 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...