#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
#include "koala.h"
int B[100],R[100];
int minValue(int N, int W){
B[0] = 1;
for(int i=1;i<=99;i++){
B[i] = 0;
}
playRound(B,R);
for(int i=0;i<=99;i++){
if(R[i]==0){
return i;
}
}
return 0;
}
int maxValue(int N, int W){
vector<int> curr;
for(int i=0;i<=99;i++){
curr.push_back(i);
}
while(curr.size()>1){
for(int i=0;i<=99;i++){
B[i] = 0;
}
int cnt = 100/curr.size();
for(int i:curr){
B[i] = cnt;
}
playRound(B,R);
vector<int> curr2;
for(int i:curr){
if(R[i]>B[i]){
curr2.push_back(i);
}
}
curr = curr2;
}
return curr[0];
}
int greaterValue(int N, int W){
int low=0,high=6;
vector<int> v = {1,2,3,4,5,6,8};
while(1){
int mid = (low+high)/2;
for(int i=0;i<=99;i++){
B[i] = 0;
}
B[0] = v[mid];
B[1] = v[mid];
playRound(B,R);
if(R[0]>B[0] and R[1]>B[1]){
low = mid+1;
}
else if(R[0]<=B[0] and R[1]<=B[1]){
high = mid-1;
}
else if(R[0]>B[0]){
return 0;
}
else{
return 1;
}
}
return 0;
}
int n,w;
int arr[100];
void dosplit(vector<int> x, int l, int r){
if(l==1 and r==2){
for(int i=0;i<=n-1;i++){
B[i] = 0;
}
B[x[0]] = 1;
playRound(B,R);
if(R[x[0]]>B[x[0]]){
arr[x[0]] = 2;
arr[x[1]] = 1;
}
else{
arr[x[1]] = 2;
arr[x[0]] = 1;
}
return;
}
if(x.size()==1){
arr[x[0]] = l;
return;
}
int val=1;
for(int i=2;i<=1e9;i++){
int curr = r+1-i*(r-l+1);
int tot=0;
for(int j=l-curr-1;j>=l-curr-i;j--){
tot += j;
}
if(tot>l){
val = i-1;
break;
}
}
for(int i=0;i<=n-1;i++){
B[i] = 0;
}
for(int i:x){
B[i] = val;
}
playRound(B,R);
vector<int> x1,x2;
for(int i:x){
if(R[i]>B[i]){
x2.push_back(i);
}
else{
x1.push_back(i);
}
}
dosplit(x1,l,l+x1.size()-1);
dosplit(x2,r-x2.size()+1,r);
}
void allValues(int N, int W, int *P){
n = N;
w = W;
if(W==2*N){
vector<int> v;
for(int i=0;i<N;i++){
v.push_back(i);
}
dosplit(v,1,N);
for(int i=0;i<N;i++){
P[i] = arr[i];
}
}
else{
vector<int> v;
for(int i=0;i<N;i++){
v.push_back(i);
}
dosplit(v,1,N);
for(int i=0;i<N;i++){
P[i] = arr[i];
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
208 KB |
Output is correct |
2 |
Correct |
4 ms |
208 KB |
Output is correct |
3 |
Correct |
4 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
208 KB |
Output is correct |
2 |
Correct |
11 ms |
208 KB |
Output is correct |
3 |
Correct |
13 ms |
208 KB |
Output is correct |
4 |
Correct |
11 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
81 ms |
320 KB |
Output is correct |
2 |
Correct |
67 ms |
324 KB |
Output is correct |
3 |
Correct |
59 ms |
332 KB |
Output is correct |
4 |
Correct |
58 ms |
324 KB |
Output is correct |
5 |
Correct |
53 ms |
332 KB |
Output is correct |
6 |
Correct |
54 ms |
336 KB |
Output is correct |
7 |
Correct |
81 ms |
328 KB |
Output is correct |
8 |
Correct |
55 ms |
364 KB |
Output is correct |
9 |
Correct |
75 ms |
340 KB |
Output is correct |
10 |
Correct |
59 ms |
456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3054 ms |
292 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
220 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
4 ms |
380 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
5 |
Correct |
3 ms |
208 KB |
Output is correct |
6 |
Correct |
3 ms |
256 KB |
Output is correct |
7 |
Correct |
3 ms |
208 KB |
Output is correct |
8 |
Correct |
3 ms |
208 KB |
Output is correct |
9 |
Correct |
3 ms |
208 KB |
Output is correct |
10 |
Correct |
3 ms |
208 KB |
Output is correct |
11 |
Correct |
3 ms |
208 KB |
Output is correct |
12 |
Correct |
3 ms |
208 KB |
Output is correct |
13 |
Correct |
3 ms |
208 KB |
Output is correct |
14 |
Correct |
4 ms |
208 KB |
Output is correct |
15 |
Correct |
3 ms |
208 KB |
Output is correct |
16 |
Correct |
3 ms |
256 KB |
Output is correct |
17 |
Correct |
3 ms |
208 KB |
Output is correct |
18 |
Correct |
3 ms |
208 KB |
Output is correct |
19 |
Correct |
5 ms |
208 KB |
Output is correct |
20 |
Correct |
3 ms |
208 KB |
Output is correct |
21 |
Correct |
4 ms |
208 KB |
Output is correct |
22 |
Correct |
3 ms |
208 KB |
Output is correct |
23 |
Correct |
3 ms |
208 KB |
Output is correct |
24 |
Correct |
3 ms |
208 KB |
Output is correct |
25 |
Correct |
3 ms |
208 KB |
Output is correct |
26 |
Correct |
3 ms |
208 KB |
Output is correct |
27 |
Correct |
3 ms |
208 KB |
Output is correct |
28 |
Correct |
3 ms |
208 KB |
Output is correct |
29 |
Correct |
3 ms |
208 KB |
Output is correct |
30 |
Correct |
4 ms |
208 KB |
Output is correct |
31 |
Correct |
3 ms |
208 KB |
Output is correct |
32 |
Correct |
3 ms |
208 KB |
Output is correct |
33 |
Correct |
3 ms |
324 KB |
Output is correct |
34 |
Correct |
3 ms |
208 KB |
Output is correct |
35 |
Correct |
3 ms |
208 KB |
Output is correct |
36 |
Correct |
4 ms |
256 KB |
Output is correct |
37 |
Correct |
5 ms |
208 KB |
Output is correct |
38 |
Correct |
3 ms |
336 KB |
Output is correct |
39 |
Correct |
3 ms |
324 KB |
Output is correct |
40 |
Correct |
3 ms |
208 KB |
Output is correct |