Submission #120954

# Submission time Handle Problem Language Result Execution time Memory
120954 2019-06-25T20:05:18 Z Rahul Koala Game (APIO17_koala) C++17
0 / 100
2 ms 384 KB
#include "koala.h"
#include <bits/stdc++.h>
using namespace std;
#define SZ(v) int((v).size())
#define ALL(vec) (vec).begin(),(vec).end()

int B[500], R[500];

static int N, W;
static int P[105];

static int maxQueries = 3200;
static int numQueries;

static void runGame(int F);
static void grader();


static void runGame(int F) {
    int i;

    scanf("%d %d",&N,&W);
    for (i=0;i<N;++i) {
        scanf("%d",&P[i]);
    }

    numQueries = 0;
    if (F == 1) {
        printf("%d\n", minValue(N, W));
    } else if (F == 2) {
        printf("%d\n", maxValue(N, W));
    } else if (F == 3) {
        printf("%d\n", greaterValue(N, W));
    } else if (F == 4) {
        int userP[105];
        allValues(N, W, userP);
        for (i=0;i<N;i++) {
            printf("%d ",userP[i]);
        }
        printf("\n");
    }
    printf("Made %d calls to playRound.\n", numQueries);
}

static void grader() {
    int i;

    int F, G;
    scanf("%d %d",&F,&G);

    for (i=0;i<G;i++) {
        runGame(F);
    }
}

int minValue(int n, int w) {
  for (int i = 0; i < 100; ++i) {
    B[i] = i < 51;
  }
  playRound(B, R);
  int m = -1;
  for (int i = 0; i < 51; ++i) {
    if (R[i] == 0) {
      m = i;
    } // else assert (R[i] == 2);
  }
  for (int i = 0; i < 100; ++i) {
    B[i] = i >= 50;
  }
  B[m] = 1;
  if (m == 50) B[49] = 1;
  playRound(B, R);
  int res = -1;
  for (int i = 50; i < 100; ++i) {
    if (R[i] == 0) {
      res = i;
    } // else assert (R[i] == 2);
  }
  if (res != -1) return res;
  if (m == 50) return 49;
  else return m;
}
int maxValue(int n, int w) {
  return 0;
}
int greaterValue(int n, int w) {
  return 0;
}
void allValues(int n, int w, int *P) {
  return;
}

Compilation message

koala.cpp:45:13: warning: 'void grader()' defined but not used [-Wunused-function]
 static void grader() {
             ^~~~~~
koala.cpp:12:12: warning: 'maxQueries' defined but not used [-Wunused-variable]
 static int maxQueries = 3200;
            ^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -