# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256246 | Sorting | Cave (IOI13_cave) | C++17 | 751 ms | 624 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 <bits/stdc++.h>
using namespace std;
const int k_N = 5000 + 3;
int tryCombination(int S[]);
void answer(int S[], int D[]);
int s[k_N], d[k_N];
vector<int> curr;
void exploreCave(int n){
for(int i = 0; i < n; ++i)
curr.push_back(i);
for(int i = 0; i < n; ++i){
for(int j = 0; j < curr.size(); ++j)
s[curr[j]] = 0;
int q1 = tryCombination(s);
if(q1 == -1) q1 = n;
int l = 0, r = (int)curr.size() - 1;
while(l != r){
int mid = (l + r + 1) >> 1;
for(int j = 0; j <= mid; ++j)
s[curr[j]] = !(q1 > i);
int q2 = tryCombination(s);
if(q2 == -1) q2 = n;
if(q2 > i) l = mid;
else r = mid - 1;
}
d[i] = curr[l];
s[i] = !(q1 > i);
curr.erase(curr.begin() + l);
}
answer(s, d);
}
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... |