Submission #1174976

#TimeUsernameProblemLanguageResultExecution timeMemory
1174976ortsacBroken Device (JOI17_broken_device)C++20
0 / 100
19 ms1344 KiB
#include "Annalib.h" #include <bits/stdc++.h> using namespace std; #define int long long void Anna(int32_t n, int x, int32_t k, int32_t p[]) { vector<int> ans(n); vector<int> broken(n); for (int i = 0; i < k; i++) broken[p[i]] = 1; vector<int> pow7(38); pow7[0] = 1; for (int i = 1; i < 38; i++) pow7[i] = (3 * pow7[i - 1]); int curr = 0; for (int i = 37; i >= 0; i--) { while (broken[curr] || broken[curr + 1]) curr += 2; int qtd = 1; while (x >= pow7[i]) { qtd++; x -= pow7[i]; } //cout << qtd << "\n"; int b0 = (qtd % 2); qtd /= 2; int b1 = (qtd % 2); ans[curr] = b0; ans[curr + 1] = b1; curr += 2; } for (int i = 0; i < n; i++) { Set(i, ans[i]); //cout << ans[i] << " "; } //cout << "\n"; }
#include "Brunolib.h" #include <bits/stdc++.h> using namespace std; #define int long long int Bruno(int32_t n, int32_t a[] ) { int curr = 37; vector<int> pow7(38); pow7[0] = 1; int ans = 0; for (int i = 1; i < 38; i++) pow7[i] = (7 * pow7[i - 1]); for (int i = 0; i < n; i += 2) { if (a[i] | a[i + 1]) { int qtd = -1; qtd += (a[i]); qtd += (2*a[i + 1]); ans += (qtd * pow7[curr]); curr--; } } //cout << ans << "\n"; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...