Submission #637998

# Submission time Handle Problem Language Result Execution time Memory
637998 2022-09-04T07:21:53 Z aris12345678 Catfish Farm (IOI22_fish) C++17
6 / 100
123 ms 17576 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
#define X first
#define Y second

ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) {
    vector<pii> A, B;
    ll first = 0LL, second = 0LL;
    for(int i = 0; i < m; i++) {
        if(x[i] == 0) {
            first += 1LL*w[i];
            A.push_back({y[i], w[i]});
        } else {
            second += 1LL*w[i];
            B.push_back({y[i], w[i]});
        }
    }
    A.push_back({INT_MAX, INT_MAX});
    B.push_back({INT_MAX, INT_MAX});
    if(n == 2)
        return max(first, second);
    ll ans = second;
    first = 0LL;
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    int i = 0, j = 0;
    while(i+j < m) {
        if(A[i].X < B[j].X)
            first += 1LL*A[i++].Y;
        else
            second -= 1LL*B[j++].Y;
        ans = max({ans, first+second});
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 28 ms 3276 KB Output is correct
2 Correct 36 ms 3784 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 115 ms 11472 KB Output is correct
6 Incorrect 123 ms 17576 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 59 ms 5684 KB Output is correct
3 Correct 74 ms 6732 KB Output is correct
4 Correct 28 ms 3296 KB Output is correct
5 Correct 36 ms 3772 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 28 ms 3276 KB Output is correct
13 Correct 38 ms 5284 KB Output is correct
14 Correct 31 ms 4192 KB Output is correct
15 Correct 35 ms 4712 KB Output is correct
16 Correct 32 ms 4264 KB Output is correct
17 Correct 35 ms 4680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 20 ms 2876 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '310323004046'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 20 ms 2876 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 3276 KB Output is correct
2 Correct 36 ms 3784 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 115 ms 11472 KB Output is correct
6 Incorrect 123 ms 17576 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -