# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
261606 | oscarsierra12 | Cave (IOI13_cave) | C++14 | 956 ms | 872 KiB |
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"
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
using namespace std ;
void exploreCave(int N) {
int ans[N], pos[N], val[N] ;
int cur[N] ;
memset ( ans, -1, sizeof ans ) ;
for ( int i = 0 ; i < N ; ++i ) {
int good = 0 ;
for ( int j = 0 ; j < N ; ++j ) cur[j] = (ans[j] == -1?1:ans[j]) ;
int x = tryCombination(cur) ;
if ( x == -1 ) x = N+5 ;
if ( x > i ) good = 1 ;
int lw = 0, hg = N-1 ;
while ( lw < hg ) {
int mid = (lw + hg) >> 1 ;
for ( int j = 0 ; j < N ; ++j ) cur[j] = (ans[j] == -1?(j <= mid?good:1-good):ans[j]) ;
x = tryCombination(cur) ;
if ( x==-1 ) x = N+5 ;
if ( x > i ) hg = mid;
else lw = mid+1 ;
}
ans[lw] = good ;
pos[lw] = i ;
}
answer (ans, pos) ;
}
Compilation message (stderr)
# | 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... |