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;
using lint = long long;
using pi = pair<lint, lint>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
namespace {
}
int Declare() {
return 180;
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
vector<int> seq;
for(int i = 0; i < 60; i++) seq.push_back((A >> i) & 1);
vector<int> X, Y;
for(int i = 0; i < 60; ){
int j = i;
while(j < 60 && seq[i] == seq[j]) j++;
for(int k = 0; k < 2 * (j - i) + 1; k++) X.push_back(seq[i]);
i = j;
}
Y.resize(sz(X));
for(int i = 0; i < sz(X); i++){
Y[i] = (i + 1) % 2;
}
return make_pair(X, Y);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<lint, lint>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
namespace {
int variable_example = 0;
}
long long Bruno(std::vector<int> u) {
int ptr = 0;
int piv = 0, sum = 0;
int previous = -1;
vector<int> ans;
while(ptr < sz(u)){
int k = piv;
int U = (k + 3 - (previous == 1));
int D = (k - 3 + (previous == 0));
while(ptr < sz(u)){
sum += u[ptr++] * 2 - 1;
if(sum >= U) break;
if(sum <= D + 1) break;
}
if(sum == U) ans.push_back(1), previous = 1, piv = U;
else if(sum == D + 1) ans.push_back(0), previous = 0, piv = D;
}
assert(sz(ans) == 60);
lint dap = 0;
for(int i = 0; i < 60; i++) if(ans[i]) dap |= (1ll << i);
return dap;
}
Compilation message (stderr)
Bruno.cpp:11:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
11 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# | 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... |