Submission #923140

#TimeUsernameProblemLanguageResultExecution timeMemory
923140gawr_guraBroken Device (JOI17_broken_device)C++17
8 / 100
32 ms2776 KiB
#include <bits/stdc++.h> #include "Annalib.h" using namespace std; void Anna(int N, long long X, int K, int P[]) { vector<int> wrong(N + 10); for (int i = 0; i < K; i++) { wrong[P[i]] = 1; } vector<int> ans(N + 10); for (int i = 0; i < N; i++) { if (wrong[i]) continue; if (X & 1) { if (wrong[i + 2]) { wrong[i + 1] = 1; continue; } ans[i] = 1, ans[i + 1] = 0, ans[i + 2] = 1; i++; } else { if (wrong[i + 1]) { wrong[i + 2] = 1; continue; } ans[i] = 1, ans[i + 1] = 1; } X /= 2; if (X == 0) break; } for (int i = 0; i < N; i++) Set(i, ans[i]); }
#include <bits/stdc++.h> #include "Brunolib.h" using namespace std; long long Bruno(int N, int A[]) { int64_t X = 0; vector<int> ans(N + 2); for (int i = 0; i < N; i++) ans[i] = A[i]; int cnt = 0; for (int i = 0; i < N; i++) { if (ans[i] == 1) { if (ans[i + 1] == 1) { cnt++; } else if (ans[i + 2] == 1) { X += 1ll << cnt++; i++; } else { continue; } } } return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...