Submission #59255

#TimeUsernameProblemLanguageResultExecution timeMemory
59255aomeCave (IOI13_cave)C++14
100 / 100
1300 ms648 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; const int N = 5005; int a[N]; int state1[N], pos1[N]; int state2[N], pos2[N]; void exploreCave(int n) { for (int i = 0; i < n; ++i) { memset(a, -1, sizeof a); for (int j = 0; j < i; ++j) { a[pos1[j]] = state1[j]; } for (int j = 0; j < n; ++j) { if (a[j] == -1) a[j] = 0; } int rep = tryCombination(a); if (rep != i) state1[i] = 0; else state1[i] = 1; for (int j = 0; (1 << j) < n; ++j) { for (int k = 0; k < n; ++k) { if (k >> j & 1) a[k] = state1[i]; else a[k] = state1[i] ^ 1; } for (int k = 0; k < i; ++k) { a[pos1[k]] = state1[k]; } rep = tryCombination(a); if (rep != i) pos1[i] += 1 << j; } pos2[pos1[i]] = i; state2[pos1[i]] = state1[i]; } answer(state2, pos2); }
#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...