Submission #969101

#TimeUsernameProblemLanguageResultExecution timeMemory
969101__Davit__Cave (IOI13_cave)C++17
100 / 100
504 ms600 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; // //void answer(int S[], int D[], int N) { // for (int i = 0; i < N; i++)cout << S[i] << " "; // cout << endl; // for (int i = 0; i < N; i++)cout << D[i] << " "; // cout << endl; //} // //int tryCombination(int S[], int N) { // cout << "! "; // for (int i = 0; i < N; i++)cout << S[i] << " "; // cout << endl; // int x; // cin >> x; // return x; //} // void exploreCave(int N) { int a[N]; int b[N]; for (int i = 0; i < N; i++)a[i] = 0; for (int i = 0; i < N; i++)b[i] = -1; int x; for (int i = 0; i < N; i++) { // x = tryCombination(a, N); x = tryCombination(a); if (x == i) { for (int j = 0; j < N; j++) { if (b[j] == -1) a[j] ^= 1; } } int ina = 0, inb = N - 1, ans = N - 1; while (ina <= inb) { int mid = (ina + inb) >> 1; for (int j = 0; j <= mid; j++) { if (b[j] == -1) a[j] ^= 1; } // x = tryCombination(a, N); x = tryCombination(a); for (int j = 0; j <= mid; j++) { if (b[j] == -1) a[j] ^= 1; } if (x == i) { ans = mid; inb = mid - 1; } else { ina = mid + 1; } } b[ans] = i; } // answer(a, b, N); answer(a, b); } //int main() { // exploreCave(4); //}
#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...