#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
int Rand(){
int G=0;
for(int i=0;i<30;i++){G+=(1<<i)*(rand()%2);}
return G;
}
int find_best(int n) {
int maxn=0;
for(int i=0;i<100;i++){
vector<int>p=ask(rand()%n);
maxn=max(maxn,p[0]+p[1]);
}
cout<<maxn<<endl;
int cx=0;
for(int i=0;i<maxn;i++){
int L=cx, R = n + 1, M, res = cx - 1;
for(int j = 0; j < 20; j++) {
M = (L + R) / 2; int MM = min(M,n-1);
vector<int>p=ask(MM);
if(p[0]+p[1] == maxn && p[0] == i) { res = max(res, MM); L = MM; }
else { R = MM; }
}
vector<int>p = ask(res+1);
if(p[0]==0 && p[1]==0) return res+1;
cx=res+2;
}
assert(false);
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Token "1" doesn't correspond to pattern "[A-B]{1}" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
336 KB |
Token "1" doesn't correspond to pattern "[A-B]{1}" |
2 |
Halted |
0 ms |
0 KB |
- |