제출 #1217919

#제출 시각아이디문제언어결과실행 시간메모리
1217919rythm_of_knightBroken Device (JOI17_broken_device)C++17
71 / 100
20 ms1560 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);
                x >>= 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 timeMemoryGrader output
Fetching results...