Submission #255235

# Submission time Handle Problem Language Result Execution time Memory
255235 2020-07-31T15:46:47 Z Osama_Alkhodairy Koala Game (APIO17_koala) C++17
22 / 100
93 ms 532 KB
#include <bits/stdc++.h>
#include "koala.h"
//~ #include "grader.cpp"
using namespace std;

int n;

bool cmp(int i, int j){
    int B[n], R[n];
    for(int i = 0 ; i < n ; i++){
        B[i] = R[i] = 0;
    }
    int l = 1, r = 9;
    while(l <= r){
        int mid = (l + r) / 2;
        B[i] = B[j] = mid;
        playRound(B, R);
        if((R[i] > B[i]) == (R[j] > B[j])){
            if(R[i] > B[j]) l = mid + 1;
            else r = mid - 1;
        }
        else return R[j] > B[j];
    }
    assert(false);
}
int minValue(int N, int W) {
    n = N;
    int B[n], R[n];
    for(int i = 0 ; i < n ; i++){
        B[i] = R[i] = 0;
    }
    B[0]++;
    playRound(B, R);
    for(int i = 0 ; i < n ; i++){
        if(B[i] >= R[i]) return i;
    }
    return 0;
}

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

int greaterValue(int N, int W) {
    n = N;
    if(cmp(0, 1)) return 1;
    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 6 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 76 ms 404 KB Output is correct
2 Correct 93 ms 384 KB Output is correct
3 Correct 77 ms 384 KB Output is correct
4 Correct 76 ms 384 KB Output is correct
5 Correct 72 ms 384 KB Output is correct
6 Correct 75 ms 408 KB Output is correct
7 Correct 76 ms 384 KB Output is correct
8 Correct 73 ms 384 KB Output is correct
9 Correct 74 ms 416 KB Output is correct
10 Correct 78 ms 532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -