제출 #205463

#제출 시각아이디문제언어결과실행 시간메모리
205463oscarsierra12커다란 상품 (IOI17_prize)C++14
0 / 100
7 ms1912 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 ) ; //while ( 1 ) { int lw = 0, hg = n-1 ; return hg ; 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 ) { return n ; 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+1 ; return n ; --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...