Submission #940582

# Submission time Handle Problem Language Result Execution time Memory
940582 2024-03-07T11:00:16 Z Ghetto Catfish Farm (IOI22_fish) C++17
0 / 100
86 ms 30316 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const int MAX_N = 1e5 + 5, MAX_M = 3e5 + 5;

int n, m;
int x[MAX_M], y[MAX_M];
lint w[MAX_M];

lint w_at[2][MAX_N];
lint w_sum[2][MAX_N];
void precomp() {
    for (int i = 0; i < m; i++)
        w_at[x[i]][y[i]] = w[i];

    for (int i = 0; i <= 1; i++)
        for (int j = 0; j < n; j++)
            w_sum[i][j] = w_at[i][j] + ((j == 0) ? 0 : w_sum[i][j - 1]);
}

void init() {
    for (int i = 0; i <= 1; i++)
        for (int j = 0; j < n; j++)
            w_at[i][j] = 0;
}

lint max_weights(int tmp_n, int tmp_m, vector<int> tmp_x, vector<int> tmp_y, vector<int> tmp_w) {
    n = tmp_n;
    m = tmp_m;
    init();
    for (int i = 0; i < m; i++) {
        x[i] = tmp_x[i];
        y[i] = tmp_y[i];
        w[i] = tmp_w[i];
    }

    precomp();

    lint ans = w_sum[1][n - 1];
    for (int y = 0; y < n; y++) {
        lint new_ans = w_sum[1][n - 1] - w_sum[1][y] + w_sum[0][y];
        ans = max(ans, new_ans);
    }   
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 21 ms 8792 KB Output is correct
2 Correct 24 ms 9312 KB Output is correct
3 Correct 1 ms 6748 KB Output is correct
4 Correct 1 ms 6748 KB Output is correct
5 Runtime error 86 ms 30316 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 39 ms 11104 KB Output is correct
3 Correct 49 ms 15632 KB Output is correct
4 Correct 20 ms 10460 KB Output is correct
5 Correct 24 ms 11092 KB Output is correct
6 Incorrect 1 ms 6492 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Runtime error 6 ms 12892 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6492 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6492 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6492 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Runtime error 6 ms 12892 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 8792 KB Output is correct
2 Correct 24 ms 9312 KB Output is correct
3 Correct 1 ms 6748 KB Output is correct
4 Correct 1 ms 6748 KB Output is correct
5 Runtime error 86 ms 30316 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -