이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std ;
#define mid (l+r)/2
#define pb push_back
#define fi first
#define se second
#define C continue
typedef long long ll ;
typedef pair < int , int > pi ;
typedef vector < int > vi ;
typedef vector < ll > vll ;
typedef vector < pi > vpi ;
#include "highway.h"
ll n , m , len , XXX , num ;
vpi v [100009] ;
vi no ;
ll query ( vi ret ) {
num ++ ;
if ( num > 60 ) {
cout << 5 / 0 << endl ;
}
vi v ( m , 0 ) ;
for ( auto u : ret ) v [u] = 1 ;
return ask (v) ;
}
void dfs ( int node , int p , int lev ) {
if ( lev == len ) {
answer ( 0 , node ) ;
return ;
}
vpi ret ;
for ( auto u : v [node] ) {
if ( u .fi == p ) C ;
ret .pb ( u ) ;
}
int l = -1 , r = ret .size () - 1 ;
while ( r - l > 1 ) {
vi crnt ;
for ( int i = mid + 1 ; i <= r ; i ++ ) {
crnt .pb ( ret [i] .se ) ;
}
int cost = query ( crnt ) ;
if ( cost == len * XXX ) {
r = mid ;
}
else {
l = mid ;
}
}
dfs ( ret [r].fi , node , lev + 1 ) ;
}
void find_pair ( int N , vi U, vi V , int A , int B ) {
n = N , m = U .size () , len = query ( no ) / A , XXX = A ;
for ( int i = 0 ; i < m ; i ++ ) {
int a = U [i] , b = V [i] ;
v [a] .pb ( { b , i } ) ;
v [b] .pb ( { a , i } ) ;
}
dfs ( 0 , 0 , 0 ) ;
}
컴파일 시 표준 에러 (stderr) 메시지
highway.cpp: In function 'll query(vi)':
highway.cpp:20:21: warning: division by zero [-Wdiv-by-zero]
20 | cout << 5 / 0 << endl ;
| ~~^~~
# | 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... |