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 <bits/stdc++.h>
#include "cave.h"
using namespace std;
int hsn[5123];
int por[5123];
int ans[5123];
int mdk[5123];
bool can(int k, int o) {
for(int i = 1; i <= k; i++)
if(ans[i] == -1)
hsn[i] = ans[o];
else hsn[i] = ans[i];
int p = tryCombination(hsn);
return p > o;
}
void exploreCave(int N) {
memset(ans, -1, sizeof ans);
for(int i = 0; i < N; i++) {
for(int j = 0; j < N; j++)
hsn[j] = max(0, ans[j]);
int p = tryCombination(hsn);
if(p > i || p == -1)
ans[i] = 0;
else ans[i] = 1;
int kk = 0;
for(int i = N-1; i >= 1; i /= 2)
while(i + kk <= N && can(i+kk, i))
kk += i;
mdk[kk] = i;
}
for(int i = 0; i < N; i++) {
cout<<ans[i]<<" ";
}
cout<<endl;
for(int i = 0; i < N; i++) {
cout<<mdk[i]<<" ";
}
}
# | 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... |