답안 #940586

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940586 2024-03-07T11:06:15 Z Ghetto 메기 농장 (IOI22_fish) C++17
6 / 100
79 ms 30292 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();

    if (n == 2) {
        lint ans = max(w_sum[0][n - 1], w_sum[1][n - 1]);
        return ans;
    }

    lint ans = w_sum[1][n - 1];
    for (int j = 0; j < n; j++) {
        lint new_ans = w_sum[1][n - 1] - w_sum[1][j] + w_sum[0][j];
        ans = max(ans, new_ans);
    }   
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 8792 KB Output is correct
2 Correct 23 ms 9308 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 79 ms 30292 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6744 KB Output is correct
2 Correct 37 ms 11092 KB Output is correct
3 Correct 46 ms 12256 KB Output is correct
4 Correct 19 ms 8796 KB Output is correct
5 Correct 23 ms 9308 KB Output is correct
6 Correct 1 ms 6492 KB Output is correct
7 Correct 1 ms 6492 KB Output is correct
8 Correct 1 ms 6588 KB Output is correct
9 Correct 1 ms 6996 KB Output is correct
10 Correct 2 ms 6748 KB Output is correct
11 Correct 2 ms 6748 KB Output is correct
12 Correct 19 ms 10320 KB Output is correct
13 Correct 29 ms 11092 KB Output is correct
14 Correct 19 ms 10332 KB Output is correct
15 Correct 22 ms 10844 KB Output is correct
16 Correct 19 ms 10236 KB Output is correct
17 Correct 21 ms 10576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Runtime error 6 ms 12888 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Runtime error 6 ms 12888 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 8792 KB Output is correct
2 Correct 23 ms 9308 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 79 ms 30292 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -