제출 #288147

#제출 시각아이디문제언어결과실행 시간메모리
288147infinite_iq통행료 (IOI18_highway)C++14
6 / 100
92 ms2588 KiB
#include <bits/stdc++.h> using namespace std ; #define mid (l+r)/2 #define pb push_back typedef long long ll ; typedef vector < int > vi ; typedef vector < ll > vll ; #include "highway.h" ll n , m , len ; vi no ; ll query ( vi ret ) { vi v ( m , 0 ) ; for ( auto u : ret ) v [u] = 1 ; return ask (v) ; } void find_pair ( int N , vi U, vi V , int A , int B ) { n = N , m = U .size () , len = query ( no ) / A ; ll l = 0 , r = n - 1 ; while ( r - l > len ) { vi ret ; for ( ll i = mid ; i < r ; i ++ ) ret .pb ( i ) ; ll cost = query ( ret ) ; if ( cost == len * A ) { r = mid ; } else if ( cost == len * B ) { l = mid ; } else { for ( ll i = 1 ; i <= mid - l ; i ++ ) { if ( i * A + ( len - i ) * B == cost ) { ll x = mid ; l = x - i , r = x + len - i ; goto out ; } } } } out :; answer ( (int)l , (int)r ) ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...