답안 #745731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
745731 2023-05-21T05:47:59 Z inventiontime 메기 농장 (IOI22_fish) C++17
0 / 100
93 ms 17772 KB
#include "fish.h"

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define re resize
#define ff first
#define ss second

#define all(x) (x).begin(), (x).end()
#define all1(x) (x).begin()+1, (x).end()
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, n) for(int i = 1; i <= n; i++)

#define print(x) cout << #x << ": " << x << endl << flush

template<class T> bool ckmin(T&a, T b) { bool B = a > b; a = min(a, b); return B; }
template<class T> bool ckmax(T&a, T b) { bool B = a < b; a = max(a, b); return B; }

typedef long long ll;
typedef vector<int> vi;

ll max_weights(int n, int m, vi x, vi y, vi w) {

    ll fish[2][n];
    loop(i, n) {
        fish[0][i] = 0;
        fish[1][i] = 0;
    }
    loop(i, m) 
        fish[x[i]][y[i]] = w[i];

    ll res = 0;
    loop1(i, n-1) fish[0][i] += fish[0][i-1];
    loop1(i, n-1) fish[1][i] += fish[1][i-1];
    res = max(fish[0][n-1], fish[1][n-1]);
    if(n >= 3) 
        loop1(i, n-1) 
            ckmax(res, fish[1][n-1] + fish[0][i] - fish[1][i]);
    
    return res;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 3532 KB Output is correct
2 Correct 28 ms 4164 KB Output is correct
3 Correct 2 ms 1748 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Runtime error 93 ms 17772 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Runtime error 2 ms 3540 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Runtime error 2 ms 3540 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 3532 KB Output is correct
2 Correct 28 ms 4164 KB Output is correct
3 Correct 2 ms 1748 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Runtime error 93 ms 17772 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -