이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "koala.h"
#include <string.h>
#define N 100
int minValue(int n, int w) {
static int bb[N], rr[N];
int i;
memset(bb, 0, n * sizeof *bb), bb[0] = 1;
playRound(bb, rr);
for (i = 1; i < n; i++)
if (rr[i] == 0)
return i;
return 0;
}
int aa[][3] = { { 2, 4, 11 }, { 2, 4, 6 }, { 2, 4, 0 }, { 2, 0, 0 }, { 0, 0, 0 } };
int kk[] = { 3, 3, 2, 1, 0 };
char used[N];
int maxValue(int n, int w) {
static int bb[N], rr[N];
int g, i, r, cnt;
if (n >= 44)
g = 0;
else if (n >= 20)
g = 1;
else if (n >= 8)
g = 2;
else if (n >= 4)
g = 3;
else if (n >= 2)
g = 4;
else {
for (i = 0; i < N; i++)
if (!used[i])
return i;
return -1;
}
for (i = 0; i < N; i++)
bb[i] = !used[i];
playRound(bb, rr);
for (r = 0; r < kk[g]; r++) {
for (i = 0; i < N; i++)
if (bb[i] && rr[i])
bb[i] = aa[g][r];
else
bb[i] = 0;
playRound(bb, rr);
}
cnt = 0;
for (i = 0; i < N; i++)
if (bb[i] && rr[i])
cnt++;
for (i = 0; i < N; i++)
if (bb[i] && rr[i])
return i;
return -1;
}
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 *pp) {
if (w == 2*n) {
// TODO: Implement Subtask 4 solution here.
// You may leave this block unmodified if you are not attempting this
// subtask.
} else {
int p;
for (p = n; p >= 1; p--) {
int i = maxValue(p, p);
used[i] = 1, pp[i] = p;
}
}
}
# | 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... |