# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
565305 | Sorting | Broken Device 2 (JOI22_device2) | C++17 | 95 ms | 3620 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int BITS = 60;
static const int C = 3;
int Declare() {
return C * BITS;
}
pair<vector<int>, vector<int>> Anna(ll a) {
vector<int> v1, v2;
for(ll i = 0; i < C * BITS; i += 2){
v1.push_back(0);
v1.push_back(1);
}
for(ll i = 0; i < BITS; ++i){
ll bit = (a >> i) & 1ll;
for(ll j = 0; j < C; ++j)
v2.push_back(bit);
}
return {v1, v2};
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int BITS = 60;
static const int C = 3;
ll Bruno(vector<int> u) {
ll curr = 0, prefix = 0;
vector<ll> bits;
for(ll i = 0; i < u.size(); ++i){
prefix += u[i] ? 1 : -1;
if(prefix <= curr - C){
bits.push_back(0);
curr -= C;
}
else if(prefix >= curr + C - 1){
bits.push_back(1);
curr += C;
}
}
ll ans = 0;
for(ll i = 0; i < bits.size(); ++i)
ans += bits[i] << i;
assert(bits.size() == BITS);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |