이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
template<typename A, typename B>
string to_string(pair<A, B>);
string to_string(string s) {
return '"' + s + '"';
}
string to_string(char c) {
return "'"s + c + "'";
}
string to_string(const char* c) {
return to_string(string(c));
}
string to_string(bool b) {
return (b ? "true" : "false");
}
template<size_t T>
string to_string(bitset<T> bs) {
return bs.to_string();
}
string to_string(vector<bool> v) {
string res = "{";
for (int i = 0; i < int(v.size()); ++i) {
if (int(res.size()) > 1) {
res += ", ";
}
res += to_string(v[i]);
}
res += "}";
return res;
}
template<typename T>
string to_string(T v) {
string res = "{";
for (auto x : v) {
if (int(res.size()) > 1) {
res += ", ";
}
res += to_string(x);
}
res += "}";
return res;
}
template<typename A, typename B>
string to_string(pair<A, B> p) {
return '(' + to_string(p.first) + ", " + to_string(p.second) + ')';
}
void debug_out() {
cerr << endl;
}
template<typename H, typename... T>
void debug_out(H head, T... tail) {
cerr << " " << to_string(head);
debug_out(tail...);
}
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]", debug_out(__VA_ARGS__)
#else
#define debug(...) void(37)
#endif
int* fuck(vector<int>& v) {
return &v[0];
}
void exploreCave(int N) {
vector<int> s(N), d(N, -1);
for (int f = 0; f < N; ++f) {
debug(f, s, d);
auto Check = [&](int x, bool inv = false) {
vector<int> ask(N);
for (int i = 0; i < N; ++i) {
ask[i] = (d[i] != -1 ? s[i] : i <= x ? inv : !inv);
}
//debug(ask);
int res = tryCombination(fuck(ask));
debug(res);
assert(res == -1 || res >= f);
return (res == -1 || res > f);
};
int ms = Check(-1, false);
int low = 0, high = N - 1;
while (low < high) {
int mid = (low + high) >> 1;
if (!Check(mid, ms)) {
low = mid + 1;
} else {
high = mid;
}
}
d[low] = f;
s[low] = ms;
debug(low);
}
answer(fuck(s), fuck(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... |