Submission #1270712

#TimeUsernameProblemLanguageResultExecution timeMemory
1270712tvgkBroken Device (JOI17_broken_device)C++20
0 / 100
18 ms1344 KiB
#include "Annalib.h" #include<bits/stdc++.h> using namespace std; #define task "a" #define se second #define fi first #define ll long long #define ii pair<ll, ll> const long mxN = 2e5 + 7; void Input(int i, string s) { for (int j = 0; j <= 2; j++) Set(i + j, s[j] - '0'); } int er[200]; void Anna(int n, long long X, int K, int P[]) { vector<int> bit; for (int i = 1; i <= n; i++) { bit.push_back(X % 2); X /= 2; } for (int i = 0; i < K; i++) er[P[i]] = 1; int ctr = 0; for (int i = 0; i < n; i += 3) { int cnt = er[i] + er[i + 1] + er[i + 2]; if (cnt >= 2) { Input(i, "000"); continue; } if (!cnt) { if (!bit[ctr] && bit[ctr + 1]) Input(i, "010"); else if (bit[ctr] && bit[ctr + 1]) Input(i, "111"); else if (!bit[ctr] && !bit[ctr + 1]) Input(i, "110"); else Input(i, "101"); ctr += 2; } else { if (bit[ctr]) { if (er[i]) Input(i, "011"); else Input(i, "100"); ctr++; } else { if (!er[i + 2]) { Input(i, "001"); ctr++; } else { if (bit[ctr + 1]) Input(i, "010"); else Input(i, "110"); ctr += 2; } } } } }
#include "Brunolib.h" #include<bits/stdc++.h> using namespace std; #define task "a" #define se second #define fi first #define ll long long #define ii pair<ll, ll> const long mxN = 2e5 + 7; string pre[10] = {"", "0", "01", "1", "1", "10", "00", "11"}; long long Bruno(int n, int A[]) { string s; for (int i = 0; i < n; i += 3) { int tmp = 0; for (int j = 0; j <= 2; j++) tmp = tmp * 2 + A[i + j]; s += pre[tmp]; } ll ans = 0; reverse(s.begin(), s.end()); for (char i : s) ans = ans * 2 + (i - '0'); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...