# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1235461 | chaeryeong | Broken Device (JOI17_broken_device) | C++20 | 19 ms | 1344 KiB |
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Anna (int N, ll X, int K, int P[]) {
const int B = 60;
vector <int> bad(N, 0);
for (int i = 0; i < K; i++) {
bad[P[i]] = 1;
}
int b = 0;
vector <int> ret(N, 0);
for (int i = 0; i < N; i += 2) {
if (bad[i] || bad[i + 1]) {
ret[i] = ret[i + 1] = 0;
} else {
ret[i] = 1;
ret[i + 1] = (X >> (b++)) & 1;
}
}
for (int i = 0; i < N; i++) {
Set(i, ret[i]);
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll Bruno (int N, int A[]) {
ll ret = 0;
int b = 0;
for (int i = 0; i < N; i += 2) {
if (A[i] == 0) {
continue;
}
ret += A[i + 1] * (1ll << (b++));
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |