# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
889782 |
2023-12-20T07:10:23 Z |
vjudge1 |
Council (JOI23_council) |
C++17 |
|
863 ms |
5956 KB |
#include <bits/stdc++.h>
using namespace std;/*
<<<<It's never too late for a new beginning in your life>>>>
Today is hard
tomorrow will worse
but the day after tomorrow will be the sunshine..
HARD WORK BEATS TALENT WHEN TALENT DOESN'T WORK HARD............
Never give up */
//The most CHALISHKANCHIK
//~ #define ff first
//~ #define ss second
//~ #define pb push_back
//~ #define all(x) x.begin(),x.end()
//~ #define rall(x) x.rbegin(),x.rend()
#define int long long
//~ typedef vector<int> vi;
//~ typedef pair<int,int> pii;
//~ typedef vector<pair<int,int> > vii;
const int N = 2e5+50, inf = 1e18, mod = 1e9+7;
void solve(){
int n, m, k;
cin >> n >> m;
k = min(950ll, n);
int a[n][m];
int rez[m]{};
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> a[i][j];
rez[j]+=a[i][j];
}
}
//~ for(auto i:rez)cout << i << ' ';
//~ cout << '\n';
int ps[k]{};
int sm = 0;
for(int i = 0; i < n; i++){
int res = 0;
for(int j = 0; j < m; j++){
res+=(rez[j] - a[i][j] >= n/2);
}
if(res >= sm){
for(int h = k-1; h > 0; h--){
ps[h] = ps[h-1];
}
sm = res;
ps[0] = i;
}
}
int ans;
for(int i = 0; i < n; i++){
ans = 0;
for(int j = 0; j < k; j++){
if(ps[j] == i)continue;
int res = 0;
for(int h = 0; h < m; h++){
res += ((rez[h] - (a[i][h] + a[ps[j]][h])) >= n/2);
}
ans = max(ans, res);
}
cout << ans << '\n';
}
}
main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t = 1;
//~ cin >> t;
while(t--){
solve();
}
}
Compilation message
council.cpp:64:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
64 | main(){
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
857 ms |
5936 KB |
Output is correct |
3 |
Correct |
857 ms |
5956 KB |
Output is correct |
4 |
Correct |
585 ms |
3156 KB |
Output is correct |
5 |
Correct |
854 ms |
5712 KB |
Output is correct |
6 |
Correct |
576 ms |
3580 KB |
Output is correct |
7 |
Correct |
863 ms |
5652 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
9 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
857 ms |
5936 KB |
Output is correct |
3 |
Correct |
857 ms |
5956 KB |
Output is correct |
4 |
Correct |
585 ms |
3156 KB |
Output is correct |
5 |
Correct |
854 ms |
5712 KB |
Output is correct |
6 |
Correct |
576 ms |
3580 KB |
Output is correct |
7 |
Correct |
863 ms |
5652 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
9 ms |
512 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
857 ms |
5936 KB |
Output is correct |
3 |
Correct |
857 ms |
5956 KB |
Output is correct |
4 |
Correct |
585 ms |
3156 KB |
Output is correct |
5 |
Correct |
854 ms |
5712 KB |
Output is correct |
6 |
Correct |
576 ms |
3580 KB |
Output is correct |
7 |
Correct |
863 ms |
5652 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
9 ms |
512 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
857 ms |
5936 KB |
Output is correct |
3 |
Correct |
857 ms |
5956 KB |
Output is correct |
4 |
Correct |
585 ms |
3156 KB |
Output is correct |
5 |
Correct |
854 ms |
5712 KB |
Output is correct |
6 |
Correct |
576 ms |
3580 KB |
Output is correct |
7 |
Correct |
863 ms |
5652 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
600 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
9 ms |
512 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |