Submission #501102

# Submission time Handle Problem Language Result Execution time Memory
501102 2022-01-02T11:14:07 Z Stickfish Koala Game (APIO17_koala) C++17
19 / 100
60 ms 440 KB
#include "koala.h"
#include <iostream>
#include <vector>
using namespace std;

const int MAXN = 101;
int b[MAXN];
int r[MAXN];

int minValue(int N, int W) {
    b[0] = 1;
    for (int i = 1; i < N; ++i)
        b[i] = 0;
    playRound(b, r);
    for (int i = 0; i < N; ++i) {
        if (r[i] == 0)
            return i;
    }
    return 0;
}

int maxValue(int N, int W) {
    vector<int> v;
    for (int i = 0; i < N; ++i)
        v.push_back(i);
    while (v.size() > 1) {
        for (int i = 0; i < N; ++i)
            b[i] = 0;
        int lb = 0, ub = (W / v.size()) + 1;
        while (ub - lb > 1) {
            int mb = (lb + ub) / 2;
            if ((mb + 1) * (mb + 2) / 2 < N)
                lb = mb;
            else
                ub = mb;
        }
        int t = lb;
        for (auto i : v)
            cerr << i << ' ';
        cerr << "| " << t << endl;
        
        for (auto i : v)
            b[i] = t;
        playRound(b, r);
        vector<int> nv;
        for (auto i : v) {
            if (r[i] > t)
                nv.push_back(i);
        }
        v = nv;
    }
    return v[0];
}

int greaterValue(int N, int W) {
    // TODO: Implement Subtask 3 solution here.
    // You may leave this function unmodified if you are not attempting this
    // subtask.
    return 0;
}

void allValues(int N, int W, int *P) {
    if (W == 2*N) {
        // TODO: Implement Subtask 4 solution here.
        // You may leave this block unmodified if you are not attempting this
        // subtask.
    } else {
        // TODO: Implement Subtask 5 solution here.
        // You may leave this block unmodified if you are not attempting this
        // subtask.
    }
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 200 KB Output is correct
2 Correct 3 ms 200 KB Output is correct
3 Correct 3 ms 200 KB Output is correct
4 Correct 3 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 336 KB Output is correct
2 Correct 57 ms 440 KB Output is correct
3 Correct 57 ms 328 KB Output is correct
4 Correct 60 ms 284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -