This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long int LLI;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
#include "koala.h"
int B[100],R[100];
int minValue(int N, int W) {
int i;
for (i = 0; i < N; i++) B[i] = 0;
B[0] = 1;
playRound(B,R);
for (i = 0; i < N; i++) {
if (R[i] == 0) return i;
}
return 0;
}
int maxValue(int N, int W) {
int i;
for (i = 0; i < N; i++) B[i] = 1;
playRound(B,R);
int c = 0;
for (i = 0; i < N; i++) {
if (R[i] == 2) B[i] = 2;
else B[i] = 0;
}
playRound(B,R);
for (i = 0; i < N; i++) {
if (R[i] == 3) c++,B[i] = 4;
else B[i] = 0;
}
playRound(B,R);
for (i = 0; i < N; i++) {
if (R[i] == 5) B[i] = 11;
else B[i] = 0;
}
playRound(B,R);
for (i = 0; i < N; i++) {
if (R[i] == 12) return i;
}
}
int greaterValue(int N, int W) {
int i;
vi poss;
for (i = 0; i < N; i++) poss.pb(i);
while (1) {
for (i = 0; i < N; i++) B[i] = 0;
for (i = 0; i < poss.size(); i++) B[poss[i]] = N/poss.size();
playRound(B,R);
if ((R[0] > 0) != (R[1] > 0)) return R[1] > 0;
vi poss2;
for (i = 0; i < poss.size(); i++) {
if (R[0] > 0) {
if (R[poss[i]] > 0) poss2.pb(poss[i]);
}
else {
if (R[poss[i]] == 0) poss2.pb(poss[i]);
}
}
poss = poss2;
}
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 (stderr)
koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:54:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < poss.size(); i++) B[poss[i]] = N/poss.size();
~~^~~~~~~~~~~~~
koala.cpp:58:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < poss.size(); i++) {
~~^~~~~~~~~~~~~
koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |