답안 #938176

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
938176 2024-03-05T01:39:03 Z irmuun 메기 농장 (IOI22_fish) C++17
9 / 100
66 ms 10064 KB
#include<bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

ll max_weights(int n,int m,vector<int>x,vector<int>y,vector<int>w){
    int even=0,X=0,Y=0;
    for(int i=0;i<m;i++){
        X=max(X,x[i]);
        Y=max(Y,y[i]);
        if(x[i]%2==0) even++;
    }
    if(even==m){
        ll ans=0;
        for(int i=0;i<m;i++){
            ans+=w[i];
        }
        return ans;
    }
    if(X<=1){
        ll ans=0,cur=0;
        for(int i=0;i<m;i++){
            if(x[i]==0){
                ans+=w[i];
            }
            else{
                cur+=w[i];
            }
        }
        if(n==2) return max(ans,cur);
        ll sum[n][2];
        memset(sum,0,sizeof sum);
        for(int i=0;i<m;i++){
            sum[y[i]][x[i]]+=w[i];
        }
        for(int i=1;i<n;i++){
            sum[i][0]+=sum[i-1][0];
            sum[i][1]+=sum[i-1][1];
        }
        ans=max(ans,cur);
        for(int i=0;i<n;i++){
            ans=max(ans,sum[i][0]+sum[n-1][1]-sum[i][1]);
        }
        return ans;
    }
    return 0ll;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 2132 KB Output is correct
2 Correct 21 ms 2652 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 65 ms 7292 KB Output is correct
6 Correct 66 ms 7276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 37 ms 5468 KB Output is correct
3 Correct 47 ms 10064 KB Output is correct
4 Correct 18 ms 3564 KB Output is correct
5 Correct 25 ms 4432 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 19 ms 5100 KB Output is correct
13 Correct 23 ms 5976 KB Output is correct
14 Correct 20 ms 5096 KB Output is correct
15 Correct 22 ms 5600 KB Output is correct
16 Correct 20 ms 4956 KB Output is correct
17 Correct 23 ms 5460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 2132 KB Output is correct
2 Correct 21 ms 2652 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 65 ms 7292 KB Output is correct
6 Correct 66 ms 7276 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 37 ms 5468 KB Output is correct
9 Correct 47 ms 10064 KB Output is correct
10 Correct 18 ms 3564 KB Output is correct
11 Correct 25 ms 4432 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 19 ms 5100 KB Output is correct
19 Correct 23 ms 5976 KB Output is correct
20 Correct 20 ms 5096 KB Output is correct
21 Correct 22 ms 5600 KB Output is correct
22 Correct 20 ms 4956 KB Output is correct
23 Correct 23 ms 5460 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
26 Halted 0 ms 0 KB -