Submission #205441

#TimeUsernameProblemLanguageResultExecution timeMemory
205441oscarsierra12The Big Prize (IOI17_prize)C++14
0 / 100
6 ms1856 KiB
#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 ) ; return 0 ; 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 ; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...