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 "cave.h"
//Billions of bilious blue blistering barnacles in a thundering typhoon!
#pragma GCC optimize("Ofast,fast-math,unroll-loops")
#pragma GCC target("avx2,fma")
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0) , cin.tie(0)
#define F first
#define S second
#define pb push_back
#define vll vector< ll >
#define vi vector< int >
#define pll pair< ll , ll >
#define pi pair< int , int >
#define all(s) s.begin() , s.end()
#define sz(s) s.size()
#define str string
#define md ((s + e) / 2)
#define mid ((l + r) / 2)
#define msdp(dp) memset(dp , -1 , sizeof dp)
#define mscl(dp) memset(dp , 0 , sizeof dp)
#define C continue
#define R return
#define B break
#define lx node * 2
#define rx node * 2 + 1
#define br(dosomething) {dosomething; break;}
#define co(dosomething) {dosomething ; continue;}
using namespace std;
typedef long long ll;
ll q, dp[500005] , a[555555] , b[555555], k, l, m, n, o, p;
map < ll , ll > mp;
vll adj[555555];
const ll mod = 1e9+7;
str s ;
void exploreCave(int N) {
n = N ;
ll cnt = 0 ;
int S[n] , D[n] ;
for(ll i = 0 ; i < n ; i++)D[i] = S[i] = 0 ;
for(ll i = 0 ; i < n ; i++){
for(ll j = 0 ; j < n ;j++){
if(a[j])C ;
S[j] = 0 ;
}
cnt++ ;
assert(cnt <= 70000) ;
int op = tryCombination(S) ;
if(op == -1 || op > i){
int l = -1 , r = n ;
while(r - l > 1){
for(ll j = 0 ; j < n ; j++){
if(a[j])C ;
if(j <= mid)S[j] = 0 ;
else S[j] = 1 ;
}
int op = tryCombination(S) ;
cnt++ ;
assert(cnt <= 70000) ;
if(op == -1 || op > i)r = mid ;
else l = mid ;
}
a[r] = 1 ;
S[r] = 0 ;
D[i] = r ;
}
else {
int l = -1 , r = n ;
while(r - l > 1){
for(ll j = 0 ; j < n ; j++){
if(a[j])C ;
if(j <= mid)S[j] = 1 ;
else S[j] = 0 ;
}
cnt++ ;
assert(cnt <= 70000) ;
int op = tryCombination(S) ;
if(op == -1 || op > i)r = mid ;
else l = mid ;
}
a[r] = 1 ;
S[r] = 1 ;
D[i] = r ;
}
}
answer(S , D) ;
}
# | 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... |