# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
783818 | YassineBenYounes | Council (JOI23_council) | C++17 | 4041 ms | 3832 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
typedef long long ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pbds tree<pair<ll, ll>, null_type, less<pair<ll,ll>>,rb_tree_tag, tree_order_statistics_node_update>
using namespace __gnu_pbds;
#define speed ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
////////////////////Only Clear Code//////////////////////////
void usaco_problem(){
freopen("milkvisits.in", "r", stdin);
freopen("milkvisits.out", "w", stdout);
}
void init(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
const int mx = 3e5+5;
const int LOG = 25;
const ll inf = 1e18;
const ll mod = 1e8;
bitset<25> arr[mx];
int sum[25];
void run_case(){
int n, m;cin >> n >> m;
for(int i = 0; i < n;i++){
for(int j = 0;j < m;j++){
int a;cin >> a;
arr[i][j] = a;
sum[j]+=a;
}
}
for(int i = 0; i < n;i++){
bitset<25> bs;
int res = 0, ans = 0;
for(int j = 0;j < m;j++){
sum[j] -= arr[i][j];
if(sum[j] == n/2)bs[j] = 1;
if(sum[j] >= n/2)res++;
}
for(int k = 0;k < n;k++){
if(i==k)continue;
int c = (bs&arr[k]).count();
ans = max(ans, res-c);
}
cout << ans << endl;
for(int j = 0;j < m;j++){
sum[j] += arr[i][j];
}
}
}
int32_t main(){
speed;
int t = 1;
//cin >> t;
while(t--){
run_case();
}
}
/*
NEVER GIVE UP!
DOING SMTHNG IS BETTER THAN DOING NTHNG!!!
Your Guide when stuck:
- Continue keyword only after reading the whole input
- Don't use memset with testcases
- Check for corner cases(n=1, n=0)
- Check where you declare n(Be careful of declaring it globally and in main)
*/
Compilation message (stderr)
# | 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... |