#include "koala.h"
#include<bits/stdc++.h>
using namespace std;
int minValue(int N, int W) {
int B[N];
int R[N];
fill(B,B+N,0);
fill(R,R+N,0);
B[0] = 1;
playRound(B,R);
for(int i = 0;i < N;i++){
if(R[i] == 0) return i;
}
}
int maxValue(int N, int W) {
int B1[N], B2[N], B3[N], B4[N];
int R1[N], R2[N], R3[N], R4[N];
for(int i = 0;i < N;i++){
B1[i] = 1;
}
playRound(B1,R1);
for(int i = 0;i < N;i++){
B2[i] = R1[i];
}
playRound(B2,R2);
for(int i = 0;i < N;i++){
if(R2[i] == 3) B3[i] = 4;
else B3[i] = 0;
}
playRound(B3,R3);
for(int i = 0;i < N;i++){
if(R3[i] == 5) B4[i] = 11;
else B4[i] = 0;
}
playRound(B4,R4);
for(int i = 0;i < N;i++){
if(R4[i] == 12) return i;
}
return 0;
}
int comp(int N, int W, int a, int b) {
int B[N];
int R[N];
fill(B,B+N,0);
B[a] = 4; B[b] = 4;
playRound(B,R);
if(R[a] == 0 && R[b] > 0) return 1; ///something stands out
else if(R[a] > 0 && R[b] == 0) return 0; ///something stands out
else if(R[a] == 0 && R[b] == 0){
fill(B,B+N,0);
B[a] = 1; B[b] = 1;
playRound(B,R);
if(R[a] == 0) return 1;
if(R[b] == 0) return 0;
fill(B,B+N,0);
B[a] = 3;
B[b] = 3;
playRound(B,R);
if(R[a] == 0) return 1;
if(R[b] == 0) return 0;
}
fill(B,B+N,0);
B[a] = 7; B[b] = 7;
playRound(B,R);
if(R[a] == 0 && R[b] > 0) return 1; ///something stands out
else if(R[a] > 0 && R[b] == 0) return 0; ///something stands out
else if(R[a] == 0 && R[b] == 0){
fill(B,B+N,0);
B[a] = 5; B[b] = 5;
playRound(B,R);
if(R[a] == 0 && R[b] > 0) return 1; ///something stands out
else if(R[a] > 0 && R[b] == 0) return 0; ///something stands out
}
else{
fill(B,B+N,0);
B[a] = 10; B[b] = 10;
playRound(B,R);
if(R[a] == 0 && R[b] > 0) return 1; ///something stands out
else if(R[a] > 0 && R[b] == 0) return 0; ///something stands out
}
return 1;
}
int greaterValue(int N, int W){
return comp(N,W,0,1);
}
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:14:1: warning: control reaches end of non-void function [-Wreturn-type]
14 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
204 KB |
Output is correct |
2 |
Correct |
6 ms |
200 KB |
Output is correct |
3 |
Correct |
6 ms |
200 KB |
Output is correct |
4 |
Correct |
7 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
200 KB |
Output is correct |
2 |
Correct |
18 ms |
200 KB |
Output is correct |
3 |
Correct |
18 ms |
316 KB |
Output is correct |
4 |
Correct |
19 ms |
312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
81 ms |
316 KB |
Output is correct |
2 |
Correct |
89 ms |
320 KB |
Output is correct |
3 |
Correct |
81 ms |
312 KB |
Output is correct |
4 |
Correct |
81 ms |
324 KB |
Output is correct |
5 |
Correct |
82 ms |
316 KB |
Output is correct |
6 |
Correct |
85 ms |
316 KB |
Output is correct |
7 |
Correct |
84 ms |
320 KB |
Output is correct |
8 |
Correct |
83 ms |
320 KB |
Output is correct |
9 |
Correct |
82 ms |
288 KB |
Output is correct |
10 |
Correct |
87 ms |
320 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 |
- |