Submission #942389

#TimeUsernameProblemLanguageResultExecution timeMemory
942389PanndaBroken Device 2 (JOI22_device2)C++17
80 / 100
65 ms3372 KiB
#include "Anna.h"

#include <bits/stdc++.h>
using namespace std;

int Declare() {
    return 180;
}

pair<vector<int>, vector<int> > Anna(long long x) {
    vector<int> a, b;

    int alt = 1;
    int last = 1;
    for (int i = 0; i < 60; i++) {
        int c = x >> i & 1;
        int num = c == last ? 2 : 3;
        last = c;
        while (num--) {
            a.push_back(c);
            b.push_back(alt);
            alt ^= 1;
        }
    }

    return make_pair(a, b);
}
#include "Bruno.h"

#include <bits/stdc++.h>
using namespace std;

long long Bruno(vector<int> u) {
    long long x = 0;
    int sum = 0;
    int mag = 0;
    for (int b : u) {
        sum += b == 0 ? -1 : +1;
        if (sum == -2) {
            x += 0LL << mag;
            mag++;
            sum = 0;
        }
        if (sum == +2) {
            x += 1LL << mag;
            mag++;
            sum = 0;
        }
    }
    return x;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...