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 "prize.h"
//#include <bits/stdc++.h>
//#define ff first
//#define ss second
//using namespace std ;
//typedef pair<int,int> pii ;
/*map <int,int> mp ;
int numLess [ 7 ] ;
pii dp [ 200010 ] ;
int val [ 7 ] ;
*/
int find_best(int n) {
/* int cnt = 1 ;
memset ( dp, -1, sizeof dp ) ;
while ( 1 ) {
int lw = 0, hg = n-1 ;
while ( lw < hg ) {
int mid = (lw+hg)/2 ;
if ( dp[mid].ff == -1 ) {
vector <int> ans = ask(mid) ;
dp[mid].ff = ans[0] ;
dp[mid].ss = ans[1] ;
}
pii v = dp[mid] ;
if ( mp[v.ff+v.ss] == 0 ) {
mp[v.ff+v.ss] = cnt ;
val[cnt] = v.ff+v.ss ;
cnt++ ;
}
if ( v.ss - numLess[mp[v.ff+v.ss]] == 0 )
hg = mid ;
else lw = mid+1 ;
}
if ( dp[hg].ff == -1 ) {
vector <int> ans = ask(hg) ;
dp[hg].ff = ans[0] ;
dp[hg].ss = ans[1] ;
}
pii v = dp[hg] ;
if ( v.ff + v.ss == 0 ) return hg ;
--hg ;
if ( dp[hg].ff == -1 ) {
vector <int> ans = ask(hg) ;
dp[hg].ff = ans[0] ;
dp[hg].ss = ans[1] ;
}
v = dp[hg] ;
for ( int i = 1 ; i < 6 ; ++i )
if ( val[i] >= v.ff+v.ss ) numLess[i] += v.ss ;
}*/
return 0 ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |