#include "koala.h"
#include<bits/stdc++.h>
using namespace std;
mt19937 rng(243987);
int you[100],cnt;
int minValue(int N, int W) {
int me[100]{1};
playRound(me,you),cnt++;
for(int i=0;i<N;i++)
if(you[i]==0)
return i;
return 0;
}
int maxValue(int N, int W) {
int me[100];
vector<int>theposs(N);
iota(theposs.begin(),theposs.end(),0);
while(theposs.size()>1){
memset(me,0,sizeof me);
for(auto i:theposs)
me[i]=W/theposs.size();
playRound(me,you),cnt++;
vector<int>theposs2;
for(auto i:theposs)
if(you[i])theposs2.push_back(i);
theposs=theposs2;
}
return theposs[0];
}
int greaterValue(int N, int W) {
int me[100]{1,1};
int L=1,R=8;
while(L<=R){
int mid=L+R>>1;
me[0]=mid;
me[1]=mid;
playRound(me,you),cnt++;
if(you[0]-you[1])
return cerr<<mid,!you[0];
if(you[0])
L=mid+1+(L==1&&R==8);
else R=mid-1;
L=min(R,L);
}
return 0;
}
int lst[101];
int smal[101];
int greaterValue2(int A,int B) {
int me[100]{};
me[A]=70;me[B]=70;
if(cnt==700)assert(0);
playRound(me,you),cnt++;
return !you[A];
}
void allValues(int N, int W, int *P) {
vector<int>v(N);
iota(v.begin(),v.end(),0);
stable_sort(v.begin(),v.end(),[](int a,int b){
return !greaterValue2(a,b);
});
for(int i=0;i<N;i++)
P[v[i]]=N-i;
}
Compilation message
koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:35:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
35 | int mid=L+R>>1;
| ~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
4 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
344 KB |
Output is correct |
2 |
Correct |
11 ms |
344 KB |
Output is correct |
3 |
Correct |
9 ms |
344 KB |
Output is correct |
4 |
Correct |
9 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
480 KB |
Output is correct |
2 |
Correct |
50 ms |
344 KB |
Output is correct |
3 |
Correct |
44 ms |
344 KB |
Output is correct |
4 |
Correct |
44 ms |
344 KB |
Output is correct |
5 |
Correct |
44 ms |
344 KB |
Output is correct |
6 |
Correct |
48 ms |
344 KB |
Output is correct |
7 |
Correct |
44 ms |
344 KB |
Output is correct |
8 |
Correct |
46 ms |
344 KB |
Output is correct |
9 |
Correct |
45 ms |
344 KB |
Output is correct |
10 |
Correct |
43 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
344 KB |
Output is correct |
2 |
Correct |
36 ms |
344 KB |
Output is correct |
3 |
Correct |
29 ms |
344 KB |
Output is correct |
4 |
Correct |
36 ms |
344 KB |
Output is correct |
5 |
Correct |
31 ms |
344 KB |
Output is correct |
6 |
Correct |
27 ms |
460 KB |
Output is correct |
7 |
Correct |
28 ms |
344 KB |
Output is correct |
8 |
Correct |
28 ms |
344 KB |
Output is correct |
9 |
Correct |
31 ms |
344 KB |
Output is correct |
10 |
Correct |
27 ms |
344 KB |
Output is correct |
11 |
Correct |
29 ms |
452 KB |
Output is correct |
12 |
Correct |
17 ms |
456 KB |
Output is correct |
13 |
Correct |
27 ms |
460 KB |
Output is correct |
14 |
Correct |
25 ms |
344 KB |
Output is correct |
15 |
Correct |
25 ms |
456 KB |
Output is correct |
16 |
Correct |
25 ms |
344 KB |
Output is correct |
17 |
Correct |
25 ms |
344 KB |
Output is correct |
18 |
Correct |
24 ms |
344 KB |
Output is correct |
19 |
Correct |
29 ms |
344 KB |
Output is correct |
20 |
Correct |
25 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |