답안 #1072431

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072431 2024-08-23T18:59:27 Z vjudge1 메기 농장 (IOI22_fish) C++17
0 / 100
85 ms 23980 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
using ii = pair <ll, ll>;
using vii = vector <ii>;
using vi = vector <int>;

const ll MAXN = 1E5+16, INF = ll(1E18)+16;
ll dp[MAXN];
vii ccs[MAXN];
ll max_weights (int n, int m, vi vx, vi vy, vi vw) {
    for (ll i = 0; i < m; i++)
        ccs[vx[i]].push_back({ vy[i]+1, vw[i] });
    for (ll x = 0; x < n; x++) {
        sort(ccs[x].begin(), ccs[x].end());
        ccs[x].insert(ccs[x].begin(), ii{ -1, 0 });
        // ps[x].push_back(0);
        ll acc = 0;
        for (auto &[y, w] : ccs[x]) {
            acc += w;
            w = acc;
        }
    }
    auto fget = [&](ll x, ll y) -> ll { // pier at column x up until y
        if (x < 0 || n <= x) return 0;
        return (upper_bound(ccs[x].begin(), ccs[x].end(), ii{ y, INF })-1)->second;
    };
    ll ans = fget(1, n); // all second column
    for (ll y = 0; y <= n; y++) {
        ans = max(ans, fget(0, y) + fget(1, n) - fget(1, y));
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 9924 KB Output is correct
2 Correct 36 ms 11460 KB Output is correct
3 Correct 6 ms 5724 KB Output is correct
4 Correct 5 ms 5724 KB Output is correct
5 Incorrect 85 ms 23980 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '0'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 56 ms 14652 KB Output is correct
3 Correct 67 ms 17080 KB Output is correct
4 Correct 31 ms 9924 KB Output is correct
5 Correct 47 ms 11456 KB Output is correct
6 Incorrect 1 ms 2648 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5724 KB Output is correct
2 Incorrect 5 ms 5724 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2652 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5724 KB Output is correct
2 Incorrect 5 ms 5724 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 9924 KB Output is correct
2 Correct 36 ms 11460 KB Output is correct
3 Correct 6 ms 5724 KB Output is correct
4 Correct 5 ms 5724 KB Output is correct
5 Incorrect 85 ms 23980 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '0'
6 Halted 0 ms 0 KB -