답안 #849329

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
849329 2023-09-14T13:36:44 Z sonamoo 메기 농장 (IOI22_fish) C++17
9 / 100
69 ms 9584 KB
#include <fish.h>

#include <bits/stdc++.h>
#define MAX 200005
#define INF 1e12
#define ll long long
#define pii pair<int,int>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);

using namespace std;

vector<pair<ll,ll> > fish;
long long ans;
long long a1[100005] , a2[100005] , ps1[100005] , ps2[100005];
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
    int flag1 = 1 , flag2 = 1;

    for (int i = 0; i < M; i++) {
        if (X[i] >= 2) flag2 = 0;
        if (X[i]%2 == 1) flag1 = 0;

        if (X[i] == 0) a1[Y[i]+1] += W[i];
        else a2[Y[i]+1] += W[i];
        ans += W[i];
    }

    if (flag1 == 1) return ans;
    ans = 0;
    if (flag2 == 1) {
        for (int i = 1; i <= N; i++) {
            ps1[i] = ps1[i-1]+a1[i];
            ps2[i] = ps2[i-1]+a2[i];
        }

        for (int i = 0; i <= N; i++) {
            if (N >= 3) ans = max(ans , ps2[N]-ps2[i]+ps1[i]);
            ans = max(ans , ps2[i]);
            ans = max(ans , ps1[i]);
        }

        return ans;
    }
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:43:1: warning: control reaches end of non-void function [-Wreturn-type]
   43 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 2940 KB Output is correct
2 Correct 23 ms 3404 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 68 ms 9584 KB Output is correct
6 Correct 69 ms 9552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2552 KB Output is correct
2 Correct 39 ms 6992 KB Output is correct
3 Correct 46 ms 8164 KB Output is correct
4 Correct 18 ms 2908 KB Output is correct
5 Correct 23 ms 3408 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 18 ms 4444 KB Output is correct
13 Correct 28 ms 4968 KB Output is correct
14 Correct 19 ms 4952 KB Output is correct
15 Correct 21 ms 5260 KB Output is correct
16 Correct 21 ms 4952 KB Output is correct
17 Correct 22 ms 5096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Incorrect 13 ms 3928 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Incorrect 1 ms 2396 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Incorrect 13 ms 3928 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 2940 KB Output is correct
2 Correct 23 ms 3404 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 600 KB Output is correct
5 Correct 68 ms 9584 KB Output is correct
6 Correct 69 ms 9552 KB Output is correct
7 Correct 1 ms 2552 KB Output is correct
8 Correct 39 ms 6992 KB Output is correct
9 Correct 46 ms 8164 KB Output is correct
10 Correct 18 ms 2908 KB Output is correct
11 Correct 23 ms 3408 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 18 ms 4444 KB Output is correct
19 Correct 28 ms 4968 KB Output is correct
20 Correct 19 ms 4952 KB Output is correct
21 Correct 21 ms 5260 KB Output is correct
22 Correct 21 ms 4952 KB Output is correct
23 Correct 22 ms 5096 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 2652 KB Output is correct
26 Incorrect 13 ms 3928 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
27 Halted 0 ms 0 KB -