Submission #969882

# Submission time Handle Problem Language Result Execution time Memory
969882 2024-04-25T18:07:34 Z CDuong Koala Game (APIO17_koala) C++17
0 / 100
1 ms 600 KB
#include "koala.h"
#include <bits/stdc++.h>
#define isz(x) (int)x.size()
using namespace std;
 
int B[105], R[105];
 
int minValue(int N, int W) {
    return 0;
}
 
 
int maxValue(int N, int W) {
    return 0;
}
 
int greaterValue(int N, int W) {
    return 0;
}

int calc(int start, int len) {
    len = min(len, start);
    return start * len - len * (len - 1) / 2;
}

int transform(int x, int n, int val) {
    int nx = max(x, n - n / (val + 1) + 1);
    int start = x - 1 - (n - (n - nx + 1) * (val + 1));
    // cout << nx << " " << start << endl;
    while (nx <= n and nx <= calc(start, val + 1)) {
        ++nx, start -= val + 1;
        // cout << nx << " " << start << endl;
    }
    return nx;
}

void allValues(int n, int w, int *ans) {
    if (w == 2 * n) {
        return;
    }

    auto cook = [&](auto self, vector<int> idx, int l, int r) -> void {
        if (l == r) ans[idx.front()] = 0;
        for (int i = w / (r - l); i >= 1; --i) {
            int nl = transform(l, r, i);
            if (l < nl and nl < r) {
                fill(B, B + n, 0);
                for (auto idx_ : idx) B[idx_] = i;
                playRound(B, R);
                vector<int> left, right;
                for (auto idx_ : idx) {
                    if (R[idx_] > i) right.emplace_back(idx_);
                    else left.emplace_back(idx_);
                }
                self(self, left, l, l + isz(left));
                self(self, right, r - isz(right), r);
                assert(l + isz(left) == r - isz(right));
                return;
            }
            assert(0);
        }
    };
    vector<int> idx(n);
    iota(idx.begin(), idx.end(), 0);
    cook(cook, idx, 1, n + 1);
}

// int main() {
//     cout << transform(92, 100, 11) << endl;
// }
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -