Submission #1086801

#TimeUsernameProblemLanguageResultExecution timeMemory
1086801coldbr3wCouncil (JOI23_council)C++17
16 / 100
4041 ms53072 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<long long, long long> #define pb push_back #define F first #define S second #define all(x) (x).begin(), (x).end() const ll N = 3e5 + 100; const ll inf = 1e17; const ll mod = 1e9 + 7; const ll block = 350; ll n,m; ll a[N][21], res[N], cnt[N]; void to_thic_cau(){ cin >> n >> m; for(int i = 1; i <= n;i++){ for(int j = 1; j <= m;j++){ cin >> a[i][j]; if(a[i][j] == 1) cnt[j]++; } } for(int i = 1; i <= n;i++){ for(int j = i + 1; j <= n;j++){ for(int k = 1; k <= m;k++){ if(a[i][k] == 1) cnt[k]--; if(a[j][k] == 1) cnt[k]--; } ll cur = 0; for(int k = 1; k <= m;k++){ if(cnt[k] >= n / 2) cur++; } res[i] = max(res[i], cur); res[j] = max(res[j], cur); for(int k = 1; k <= m;k++){ if(a[i][k] == 1) cnt[k]++; if(a[j][k] == 1) cnt[k]++; } } } for(int i = 1; i <= n;i++) cout << res[i] << '\n'; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); ll tc = 1; //cin >> tc; while(tc--) to_thic_cau(); }
#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...