This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "highway.h"
#include <bits/stdc++.h>
#define debug printf
#define lp(i,a,b) for(int i=a;i<b;i++)
#define pii pair<int,int>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
const int MAXN = 9e4+ 10 ;
const int MAXM = 13e4+10 ;
using namespace std ;
struct Edge
{
int j , id ;
Edge(int j = 0 , int id = 0)
: j(j) , id(id) {}
} ;
int n , m , S , T ;
vector<int> toAsk ;
ll oldVal , newVal ;
bool marcV[MAXN] , marc[MAXM] ;
vector<Edge> adj[MAXN] ;
// --------------------------------
void dfs( int x )
{
marcV[x] = true ;
for(Edge e : adj[x])
if( !marcV[e.j] && marc[e.id] )
{ dfs(e.j) ; return ; }
T = x ;
}
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
m = U.size();
n = N ;
lp(i,0,m)
{
int a = U[i] , b = V[i] ;
adj[a].pb(Edge(b,i)) ;
adj[b].pb(Edge(a,i)) ;
toAsk.pb(0) ;
}
ll oldVal = ask(toAsk) ;
lp(i,0,m)
{
toAsk[i] = 1 ;
newVal = ask(toAsk) ;
toAsk[i] = 0 ;
if( A < B ? newVal > oldVal : newVal < oldVal ) marc[i] = true ;
}
dfs(0) ;
answer(S,T) ;
}
# | 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... |