Submission #1217755

#TimeUsernameProblemLanguageResultExecution timeMemory
1217755rythm_of_knightBroken Device (JOI17_broken_device)C++17
71 / 100
22 ms1556 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);
                x >>= 1;
                Set(i + 1, x & 1);
                x >>= 1;
            } else {
                Set(i, 0);
                Set(i + 1, 1);
                x >>= 1;
            }
        } else {
            Set(i, 0);
            Set(i + 1, 0);
        }
    }
}
#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 timeMemoryGrader output
Fetching results...