제출 #797363

#제출 시각아이디문제언어결과실행 시간메모리
797363errayCave (IOI13_cave)C++17
100 / 100
525 ms548 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...