Submission #729689

#TimeUsernameProblemLanguageResultExecution timeMemory
729689Jean7Cave (IOI13_cave)C++14
100 / 100
689 ms640 KiB
#include "cave.h" #include <bits/stdc++.h> #define mid ((l+r)>>1) using namespace std ; int s[5002] , cur[5002] , d[5002] ; void exploreCave ( int n ) { for ( int i = 0 ; i < n ; i++ ) { s[i] = -1 ; } for ( int i = 0 ; i < n ; i++ ) { for ( int j = 0 ; j < n ; j++ ) { cur[j] = max ( 0 , s[j] ) ; } bool o = ( tryCombination(cur) == i ) ; int l = 0 , r = n ; while ( r - l > 1 ) { for ( int j = 0 ; j < n ; j++ ) { if ( s[j] != -1 ) { cur[j] = s[j] ; } else { if ( j < mid ) { cur[j] = 0 ; } else { cur[j] = 1 ; } } } if ( tryCombination(cur) == i ) { if ( o ) { r = mid ; } else { l = mid ; } } else { if ( o ) { l = mid ; } else { r = mid ; } } } s[l] = o ; d[l] = i ; } answer(s,d) ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...