# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
889739 | vjudge1 | Council (JOI23_council) | C++17 | 209 ms | 5592 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 = 200;
int a[n][m];
int sum[m]{}, 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 ans, cnt;
if(n <= 9000){
for(int i = 0; i < n; i++){
ans = 0;
for(int j = 0; j < n; j++){
if(j == i)continue;
cnt = 0;
for(int k = 0; k < m; k++){
sum[k] = rez[k];
sum[k] -= a[i][k];
sum[k] -= a[j][k];
if(sum[k] >= n/2)cnt++;
}
//~ cout << '\n';
ans = max(cnt, ans);
}
cout << ans << '\n';
}
}
else{
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 = 200; h > 0; h--){
ps[h] = ps[h-1];
}
sm = res;
ps[0] = i;
}
}
for(int i = 0; i < n; i++){
int 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[m] - (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();
}
}
컴파일 시 표준 에러 (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... |