Submission #414069

#TimeUsernameProblemLanguageResultExecution timeMemory
414069illyakrCave (IOI13_cave)C++14
100 / 100
300 ms668 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; int S[101010]; int D[101010]; bool dont[101010]; void sw(int l, int r) { for (int i = l; i <= r; i++) { if (dont[i])continue; S[i] ^= 1; } } void exploreCave(int N) { // cout << "START " << N << endl; for (int i = 0; i < N; i++) { // cout << i << " <<!!!!! " << endl; int gg = tryCombination(S); if (gg == -1 || gg > i); else sw(0, N - 1); // for (int j = 0; j < N; j++)cout << S[j] << " "; // cout << endl; int l = 0, r = N - 1; while (l < r) { int mid = (l + r) / 2; sw(l, mid); gg = tryCombination(S); if (gg == -1 || gg > i)l = mid + 1; else { sw(l, mid); r = mid; } } // cout << i << " --- " << l << " " << r << endl; D[l] = i; dont[l] = true; } // cout << "END" << endl; // for (int i = 0; i < N; i++) // cout << S[i] << " "; // cout << endl; // for (int i = 0; i < N; i++) // cout << D[i] << " "; // cout << endl; answer(S, 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...