# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1217916 | rythm_of_knight | Broken Device (JOI17_broken_device) | C++17 | 19 ms | 1536 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[]) {
vector <int> a(n, 1);
for (int i = 0; i < k; i++)
a[p[i]] = 0;
for (int i = 0; i < n; i += 2) {
if (a[i] && a[i + 1]) {
if (x & 1) {
Set(i, 1);
// cout << 1;
x >>= 1;
Set(i + 1, x & 1);
// cout << (x & 1);
x >>= 1;
} else {
Set(i, 0);
Set(i + 1, 1);
// cout << "01";
x >>= 1;
}
} else {
Set(i, 0);
if (a[i + 1] && x % 2 == 0) {
Set(i + 1, 1);
} else {
Set(i + 1, 0);
}
// cout << "00";
}
}
// cout << '\n';
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll Bruno (int n, int a[]) {
ll now = 1, ans = 0;
for (int i = 0; i < n; i += 2) {
if (a[i]) {
ans += a[i] * now;
now <<= 1;
ans += a[i + 1] * now;
now <<= 1;
} else if (a[i + 1]) {
now <<= 1;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |