Submission #409216

# Submission time Handle Problem Language Result Execution time Memory
409216 2021-05-20T11:23:54 Z cheissmart Koala Game (APIO17_koala) C++14
19 / 100
17 ms 320 KB
#ifndef CHEISSMART
#include "koala.h"
#endif
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

string _reset = "\u001b[0m", _yellow = "\u001b[33m", _bold = "\u001b[1m";
void DBG() { cerr << "]" << _reset << endl; }
template<class H, class...T> void DBG(H h, T ...t) {
    cerr << to_string(h);
    if(sizeof ...(t)) cerr << ", ";
    DBG(t...);
}
#ifdef CHEISSMART
#define debug(...) cerr << _yellow << _bold << "Line(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define debug(...)
#endif

const int INF = 1e9 + 7;

int a[100], b[100];

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

int maxValue(int N, int W) {
    set<int> s;
    for(int i = 0; i < N; i++)
        s.insert(i);
    while(s.size() > 1) {
        int x = s.size();
        for(int i = 0; i < N; i++) {
            if(s.count(i)) {
                a[i] = W / x;
            } else {
                a[i] = 0;
            }
        }
        s.clear();
        playRound(a, b);
        for(int i = 0; i < N; i++)
            if(b[i] == W / x + 1)
                s.insert(i);
    }
    return *s.begin();
}

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.
    }
}

Compilation message

koala.cpp: In function 'int minValue(int, int)':
koala.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^
koala.cpp:47:10: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |     a[k] = 1;
      |     ~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 200 KB Output is correct
2 Correct 8 ms 312 KB Output is correct
3 Correct 8 ms 200 KB Output is correct
4 Correct 8 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 200 KB Output is correct
2 Correct 17 ms 320 KB Output is correct
3 Correct 17 ms 200 KB Output is correct
4 Correct 16 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 -