이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 compare(int a,int b,int N,int W) {
int i,j;
for (j = 0; j < N; j++) B[j] = 0;
B[a] = B[b] = 1;
playRound(B,R);
if ((R[a] > 0) != (R[b] > 0)) return R[b] > 0;
for (j = 0; j < N; j++) B[j] = 0;
B[a] = B[b] = 11;
playRound(B,R);
if ((R[a] > 0) != (R[b] > 0)) return R[b] > 0;
for (j = 0; j < N; j++) B[j] = 0;
B[a] = B[b] = 3;
playRound(B,R);
if ((R[a] > 0) != (R[b] > 0)) return R[b] > 0;
for (j = 0; j < N; j++) B[j] = 0;
B[a] = B[b] = 6;
playRound(B,R);
if ((R[a] > 0) != (R[b] > 0)) return R[b] > 0;
return -1;
}
int greaterValue(int N, int W) {
return compare(0,1,N,W);
}
int n,w;
int inv[100];
bool comp(int a,int b) {
if (a == b) return 0;
else return compare(a,b,n,w);
}
void allValues(int N, int W, int *P) {
n = N,w = W;
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 i;
for (i = 0; i < N; i++) inv[i] = i;
random_shuffle(inv,inv+N);
sort(inv,inv+N,comp);
for (i = 0; i < N; i++) P[inv[i]] = i+1;
}
}
컴파일 시 표준 에러 (stderr) 메시지
koala.cpp: In function 'int compare(int, int, int, int)':
koala.cpp:49:9: warning: unused variable 'i' [-Wunused-variable]
int i,j;
^
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... |