제출 #791894

#제출 시각아이디문제언어결과실행 시간메모리
791894t6twotwoUnscrambling a Messy Bug (IOI16_messy)C++17
0 / 100
1 ms468 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; string S; void f(int l, int r) { if (l + 1 == r) { return; } int m = (l + r) / 2; for (int i = l; i < m; i++) { S[i] = '1'; add_element(S); cout << S << "\n"; S[i] = '0'; } fill(S.begin() + m, S.begin() + r, '1'); f(l, m); fill(S.begin() + m, S.begin() + r, '0'); fill(S.begin() + l, S.begin() + m, '1'); f(m, r); fill(S.begin() + l, S.begin() + m, '0'); } vector<int> restore_permutation(int N, int W, int R) { S = string(N, '0'); f(0, N); compile_set(); vector<int> P(N); for (int i = __lg(N) - 1; i >= 0; i--) { auto a = P; for (int j = 0; j < N; j++) { string S(N, '0'); for (int k = 0; k < N; k++) { if (a[j] != a[k] || j == k) { S[k] = '1'; } } if (!check_element(S)) { P[j] += 1 << i; } } } return P; }
#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...