Submission #923143

#TimeUsernameProblemLanguageResultExecution timeMemory
923143gawr_guraBroken Device (JOI17_broken_device)C++17
45 / 100
27 ms2892 KiB
#include <bits/stdc++.h> #include "Annalib.h" using namespace std; mt19937 rd(0303); long long random(long long l, long long h) { assert(l <= h); return uniform_int_distribution<long long>(l, h)(rd); } void Anna(int N, long long X, int K, int P[]) { X += random(1e17, (1ll << 60) - 1e18); 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; mt19937 rd(0303); long long random(long long l, long long h) { assert(l <= h); return uniform_int_distribution<long long>(l, h)(rd); } 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 - random(1e17, (1ll << 60) - 1e18); }
#Verdict Execution timeMemoryGrader output
Fetching results...