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 <algorithm>
#include <iostream>
bool found[5005];
int yer[5005];
using std::endl;
using std::cout;
int ara(int A[], int N, int L, int R, int T, int O) {
if(L >= R) return L;
int B[N];
for(int i = 0; i < N; i++) {
B[i] = A[i];
}
int mid = (R+L)/2;
for(int i = L; i <= mid; i++) {
if(!found[i]) {
B[i] = !B[i];
}
}
int x = tryCombination(B);
if(x == T) {
return ara(A, N, mid+1, R, T, O);
} else {
return ara(A, N, L, mid, T, O);
}
}
void exploreCave(int N) {
int A[N];
for(int i = 0; i < N; i++) A[i] = 0;
int D[N];
int cur = 0;
int tmp = 0;
int i = 0;
for(int i = 0; i < N; i++) {
int x = tryCombination(A);
if(x == i) {
int y = ara(A, N, 0, N-1, i, 0);
D[y] = i;
found[y] = true;
A[y] = !A[y];
} else {
int y = ara(A, N, 0, N-1, i, 0);
cout << y << endl;
found[y] = true;
D[y] = i;
}
}
answer(A,D);
}
Compilation message (stderr)
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:35:9: warning: unused variable 'cur' [-Wunused-variable]
35 | int cur = 0;
| ^~~
cave.cpp:36:9: warning: unused variable 'tmp' [-Wunused-variable]
36 | int tmp = 0;
| ^~~
cave.cpp:37:9: warning: unused variable 'i' [-Wunused-variable]
37 | int i = 0;
| ^
# | 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... |