이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std ;
#define mid (l+r)/2
#define pb push_back
typedef vector < int > vi ;
#include "highway.h"
int n , m , len ;
vi no ;
int 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 ;
int l = 0 , r = n - 1 ;
// cout << len << endl ;
while ( r - l > len ) {
// cout << l << " " << r << " " << mid << " " ;
vi ret ;
for ( int i = mid ; i < r ; i ++ ) ret .pb ( i ) ;
int cost = query ( ret ) ;
// cout << cost << endl ;
if ( cost == len * A ) {
r = mid ;
}
else if ( cost == len * B ) {
l = mid ;
}
else {
for ( int i = 1 ; i <= mid - l ; i ++ ) {
if ( i * A + ( len - i ) * B == cost ) {
l = mid - i , r = mid + len - i ;
}
}
}
}
// cout << l << " " << r << endl ;
answer ( l , r ) ;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |