Submission #778709

# Submission time Handle Problem Language Result Execution time Memory
778709 2023-07-10T15:25:17 Z benjaminkleyn Bali Sculptures (APIO15_sculpture) C++17
0 / 100
1 ms 212 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma,bmi,bmi2")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int n, A, B;
ll x[2000];
bool start[2000] = {false};
int cnt = 0;

int main()
{
    cin.tie(0)->sync_with_stdio(0);

    cin >> n >> A >> B;
    for (int i = 0; i < n; i++)
        cin >> x[i];

    ll ans = 0;
    for (ll y = 1LL << 41; y >= 1; y /= 2)
    {
        ll sum = y;
        vector<int> new_splits;
        for (int i = 0; i < n; i++)
        {
            if (start[i])
                sum = 0;
            else if (sum + x[i] >= ans + y)
            {
                sum = 0, start[i] = true;
                new_splits.push_back(i);
                cnt++;
            }
            sum += x[i];
        }
        if (cnt > B)
        {
            ans += y, cnt -= new_splits.size();
            for (int i : new_splits)
                start[i] = false;
        }
    }
    cout << ans << '\n';

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -