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 <bits/stdc++.h>
using namespace std ;
int n , s[5000] , d[5000] ;
void solve2 () {
for ( int i = 0 ; i < n ; i++ ) {
s[i] = 0 ;
}
for ( int i = 0 ; i < n ; i++ ) {
s[i] = 1 ;
d[i] = tryCombination(s) ;
s[i] = 0 ;
}
answer(s,d) ;
}
void solve1 () {
for ( int i = 0 ; i < n ; i++ ) {
d[i] = i ;
s[i] = 0 ;
}
for ( int i = 0 ; i < n ; i++ ) {
int x = tryCombination(s) ;
if ( x == -1 ) {
break ;
}
s[x] = 1 ;
}
answer(s,d) ;
}
void solve () {
for ( int i = 0 ; i < n ; i++ ) {
s[i] = 0 ;
}
if ( tryCombination(s) != -1 ) {
solve1 () ;
}
else {
solve2 () ;
}
}
void exploreCave ( int N ) {
n = N ;
if ( n > 100 ) {
solve () ;
}
for ( int j = 0 ; j < n ; j++ ) {
for ( int i = 0 ; i < n ; i++ ) {
s[i] = 1 ;
int x = tryCombination(s) ;
s[i] = 0 ;
int y = tryCombination(s) ;
if ( x == -1 ) {
x = 1e9 ;
}
if ( y == -1 ) {
y = 1e9 ;
}
if ( x == y ) {
continue ;
}
if ( x < y ) {
s[i] = 0 ;
d[i] = x ;
}
else {
s[i] = 1 ;
d[i] = y ;
}
}
}
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... |