Submission #404235

# Submission time Handle Problem Language Result Execution time Memory
404235 2021-05-14T01:37:51 Z Haruto810198 Koala Game (APIO17_koala) C++17
19 / 100
15 ms 312 KB
#include <bits/stdc++.h>
#include "koala.h"

using namespace std;

//#define int long long
#define double long double

#define FOR(i,l,r,d) for(int i=(l);i<=(r);i+=(d))
#define szof(x) ((x).size())

#define vi vector<int>
#define pii pair<int,int>

#define F first
#define S second

#define pb push_back
#define eb emplace_back
#define mkp make_pair

const int INF = 2147483647;
const int MOD = 1000000007;
const int mod = 998244353;
const double eps = 1e-12;

int minValue(int N, int W) {
    // TODO: Implement Subtask 1 solution here.
    // You may leave this function unmodified if you are not attempting this
    // subtask.

    int B[N];
    int R[N];

    FOR(i,0,N-2,1){
        B[i] = 0;
    }
    B[N-1] = 1;

    playRound(B, R);

    int res = 0;
    FOR(i,0,N-1,1){
        if(R[i]<=B[i]){
            res = i;
        }
    }

    return res;
}

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.

    int B[N];
    int R[N];
    bool isMax[N];

    /// Round 0: 100 -> 50
    /// Round 1: 50 -> 25
    /// Round 2: 25 -> 9
    /// Round 3: 9 -> 1
    int Maxstone[4] = {1, 2, 4, 11};

    FOR(i,0,N-1,1){
        isMax[i] = 1;
    }

    FOR(Round,0,3,1){

        FOR(i,0,N-1,1){
            if(isMax[i]==1){
                B[i] = Maxstone[Round];
            }
            else{
                B[i] = 0;
            }
        }

        playRound(B, R);

        FOR(i,0,N-1,1){
            if(R[i]>B[i] and isMax[i]==1){
                isMax[i] = 1;
            }
            else{
                isMax[i] = 0;
            }
        }

    }

    FOR(i,0,N-1,1){
        if(isMax[i]){
            return i;
        }
    }

    return 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 5 ms 200 KB Output is correct
2 Correct 5 ms 312 KB Output is correct
3 Correct 7 ms 312 KB Output is correct
4 Correct 5 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 200 KB Output is correct
2 Correct 15 ms 200 KB Output is correct
3 Correct 15 ms 200 KB Output is correct
4 Correct 15 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Output isn't correct
2 Halted 0 ms 0 KB -