This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "grader.h"
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define FOR(i,start,end) for(int i=start;i<(int)(end);i++)
#define FORE(i,start,end) for(int i=start;i<=(int)end;i++)
#define RFORE(i,start,end) for(int i = start; i>=end; i--)
#define all(a) a.begin(), a.end()
#define v vector
typedef long long ll;
typedef pair<int, int > pii;
//template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> void minn(T &a, T b) { a = min(a, b); }
template<class T> void maxx(T &a, T b) { a = max(a, b); }
int go(int L, int R){
/* LIMIT--;
if(!LIMIT){
exit(0);
}
cout << "go " << L << " to " << R << endl;
*/
if(L==R) return L;
int M = (L+R)/2;
int Q1 = (L+M)/2;
int Q3 = max((M+R)/2, Q1+1);
Guess(Q1);
int res = Guess(Q3);
int X = (Q1+Q3)/2;
int XL, XR;
if((Q1+Q3)%2 == 0)
XL = X-1, XR = X+1;
else
XL = X, XR = X+1;
if(res == 0) return (Q1+Q3)/2;
else if (res == 1) return go(XR,R); // hotter
else go(L,XL); // colder
}
int HC(int N){
return go(1,N);
}
Compilation message (stderr)
hottercolder.cpp: In function 'int go(int, int)':
hottercolder.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |