#include <assert.h>
#include <iostream>
#include <algorithm>
#include "koala.h"
using namespace std;
int minValue(int N, int W) {
int B[N],R[N];
fill(B,B+N,0);
B[0]=1;
playRound(B,R);
int res=0;
for(int i=0;i<N;i++)
if(R[i]==0)
res=i;
return res;
}
int maxValue(int N, int W) {
int B[N],R[N];
int V[N];
fill(V,V+N,1);
fill(B,B+N,0);
fill(R,R+N,0);
int res=N;
while(true){
int k=(int)(N/res);
for(int i=0;i<N;i++)
B[i]=V[i]*k;
//for(int i=0;i<N;i++)cout<<B[i]<<" ";cout<<endl;
playRound(B,R);
res=0;
for(int i=0;i<N;i++){
if(V[i] and !R[i])
V[i]=false;
if(V[i] and R[i])
res++;
}
if(res==1)
for(int i=0;i<N;i++)
if(V[i] and R[i])
return i;
assert(res);
}
}
int greaterValue(int N, int W) {
int B[N],R[N];
fill(B,B+N,0);
fill(R,R+N,0);
int l=0,r=10,m;
while(l<r){
m=(l+r)/2;
B[0]=B[1]=m;
playRound(B,R);
if(R[0]!=R[1])
return R[0]<R[1];
if(R[0]==0)
r=m;
else
l=m+1;
}
}
int N;
bool comp(int a, int b){
int B[N],R[N];
fill(B,B+N,0);
fill(R,R+N,0);
int l=0,r=min(N,10),m;
while(l<r){
m=(l+r)/2;
B[a]=B[b]=m;
playRound(B,R);
if(R[a]!=R[b])
return R[a]<R[b];
if(R[a]==0)
r=m;
else
l=m+1;
}
}
void allValues(int N_, int W, int *P) {
N=N_;
int A[N];
for(int i=0;i<N;i++)
A[i]=i;
sort(A,A+N,comp);
for(int i=0;i<N;i++)
P[A[i]]=i+1;
}
Compilation message
koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:88:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
koala.cpp: In function 'bool comp(int, int)':
koala.cpp:116:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
248 KB |
Output is correct |
2 |
Correct |
7 ms |
356 KB |
Output is correct |
3 |
Correct |
8 ms |
448 KB |
Output is correct |
4 |
Correct |
12 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
500 KB |
Output is correct |
2 |
Correct |
19 ms |
500 KB |
Output is correct |
3 |
Correct |
17 ms |
500 KB |
Output is correct |
4 |
Correct |
17 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
95 ms |
628 KB |
Output is correct |
2 |
Correct |
67 ms |
628 KB |
Output is correct |
3 |
Correct |
68 ms |
820 KB |
Output is correct |
4 |
Correct |
80 ms |
820 KB |
Output is correct |
5 |
Correct |
75 ms |
820 KB |
Output is correct |
6 |
Correct |
66 ms |
820 KB |
Output is correct |
7 |
Correct |
77 ms |
820 KB |
Output is correct |
8 |
Correct |
102 ms |
820 KB |
Output is correct |
9 |
Correct |
104 ms |
820 KB |
Output is correct |
10 |
Correct |
97 ms |
820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
25 ms |
820 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
40 ms |
864 KB |
Output is partially correct |
2 |
Partially correct |
51 ms |
872 KB |
Output is partially correct |
3 |
Partially correct |
45 ms |
996 KB |
Output is partially correct |
4 |
Partially correct |
69 ms |
996 KB |
Output is partially correct |
5 |
Partially correct |
49 ms |
1036 KB |
Output is partially correct |
6 |
Partially correct |
44 ms |
1036 KB |
Output is partially correct |
7 |
Partially correct |
51 ms |
1036 KB |
Output is partially correct |
8 |
Partially correct |
45 ms |
1036 KB |
Output is partially correct |
9 |
Partially correct |
47 ms |
1036 KB |
Output is partially correct |
10 |
Partially correct |
58 ms |
1036 KB |
Output is partially correct |
11 |
Partially correct |
60 ms |
1092 KB |
Output is partially correct |
12 |
Partially correct |
39 ms |
1092 KB |
Output is partially correct |
13 |
Partially correct |
68 ms |
1092 KB |
Output is partially correct |
14 |
Partially correct |
55 ms |
1104 KB |
Output is partially correct |
15 |
Partially correct |
44 ms |
1104 KB |
Output is partially correct |
16 |
Partially correct |
47 ms |
1104 KB |
Output is partially correct |
17 |
Partially correct |
51 ms |
1116 KB |
Output is partially correct |
18 |
Partially correct |
60 ms |
1116 KB |
Output is partially correct |
19 |
Partially correct |
49 ms |
1116 KB |
Output is partially correct |
20 |
Partially correct |
46 ms |
1128 KB |
Output is partially correct |
21 |
Partially correct |
54 ms |
1128 KB |
Output is partially correct |
22 |
Partially correct |
69 ms |
1128 KB |
Output is partially correct |
23 |
Partially correct |
40 ms |
1128 KB |
Output is partially correct |
24 |
Partially correct |
46 ms |
1128 KB |
Output is partially correct |
25 |
Partially correct |
51 ms |
1128 KB |
Output is partially correct |
26 |
Partially correct |
45 ms |
1128 KB |
Output is partially correct |
27 |
Partially correct |
64 ms |
1128 KB |
Output is partially correct |
28 |
Partially correct |
60 ms |
1148 KB |
Output is partially correct |
29 |
Partially correct |
47 ms |
1164 KB |
Output is partially correct |
30 |
Partially correct |
60 ms |
1164 KB |
Output is partially correct |
31 |
Partially correct |
50 ms |
1164 KB |
Output is partially correct |
32 |
Partially correct |
50 ms |
1164 KB |
Output is partially correct |
33 |
Partially correct |
72 ms |
1164 KB |
Output is partially correct |
34 |
Partially correct |
62 ms |
1164 KB |
Output is partially correct |
35 |
Partially correct |
57 ms |
1164 KB |
Output is partially correct |
36 |
Partially correct |
52 ms |
1164 KB |
Output is partially correct |
37 |
Partially correct |
57 ms |
1164 KB |
Output is partially correct |
38 |
Partially correct |
63 ms |
1200 KB |
Output is partially correct |
39 |
Partially correct |
42 ms |
1200 KB |
Output is partially correct |
40 |
Partially correct |
45 ms |
1200 KB |
Output is partially correct |