Submission #392337

# Submission time Handle Problem Language Result Execution time Memory
392337 2021-04-20T20:00:00 Z MarcoMeijer Koala Game (APIO17_koala) C++14
19 / 100
18 ms 320 KB
#include "koala.h"
#include <bits/stdc++.h>
using namespace std;

// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define FOR(a,b) for(auto& a : b)
#define all(a) a.begin(), a.end()
#define INF 1e9
#define EPS 1e-9
#define pb push_back
#define popb pop_back
#define fi first
#define se second
#define sz size()
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MX=500;

int B[MX], R[MX];

int minValue(int N, int W) {
    RE(i,N) B[i] = 0;
    B[1] = 1;
    playRound(B,R);
    RE(i,N) if(R[i] == 0) return i;
    return 0;
}

int maxValue(int N, int W) {
    vi possible;
    RE(i,N) possible.push_back(i);
    while(possible.size() > 1) {
        int weight = W / possible.size();
        RE(i,N) B[i] = 0;
        FOR(u,possible) B[u] = weight;
        playRound(B,R);
        possible.clear();
        RE(i,N) if(R[i] > weight) possible.push_back(i);
    }
    return possible[0];
}

int greaterValue(int N, int W, int i, int j) {
    int lb=1, ub=8;
    while(lb != ub) {
        int mid=(lb+ub)/2;
        RE(i,N) B[i] = 0;
        B[i] = mid;
        B[j] = mid;
        playRound(B,R);
        if(R[i] <= mid && R[j] <= mid) ub=mid-1;
        if(R[i] > mid && R[j] > mid) lb=mid+1;
        if(R[i] <= mid && R[j] > mid) return j;
        if(R[i] > mid && R[j] <= mid) return i;
    }
    return i;
}

int greaterValue(int N, int W) {
    return greaterValue(N,W,0,1);
}

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 200 KB Output is correct
2 Correct 6 ms 200 KB Output is correct
3 Correct 6 ms 200 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 200 KB Output is correct
2 Correct 18 ms 200 KB Output is correct
3 Correct 18 ms 316 KB Output is correct
4 Correct 18 ms 320 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 -