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;
const int BITS = 60;
const int M = BITS*3 + 1;
namespace {
}
int Declare() {return M;}
pair<vector<int>, vector<int>> Anna(long long A) {
vector<int> ans,b(M);
for(int i=0;i<M;i+=2)b[i]=1;
if(A&1){
ans.emplace_back(1);
ans.emplace_back(1);
} else {
ans.emplace_back(0);
ans.emplace_back(0);
ans.emplace_back(0);
ans.emplace_back(0);
}
for(int bit=1;bit<BITS;bit++){
int a = min(A&(1ll<<bit),1ll);
ans.emplace_back(a);
ans.emplace_back(a);
ans.emplace_back(a);
}
b.resize(ans.size());
return {ans,b};
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
const int BITS = 60;
const int M = BITS*3 + 1;
namespace {
}
long long Bruno(vector<int> u) {
// assert(u.size()==2*M);
for(int&x:u)if(x==0)x=-1;
vector<int> ans;
int sum = 0;
int lastsum = 0;
for(int&x:u){
sum+=x;
if(((sum%3)+3)%3 == 1)continue;
if(sum<lastsum-1){
ans.emplace_back(0);
lastsum = sum;
} else if(sum>lastsum+1){
ans.emplace_back(1);
lastsum = sum;
}
}
assert(ans.size()==BITS);
long long res = 0;
for(int bit=0;bit<BITS;bit++)if(ans[bit])res|=(1ll<<bit);
return res;
}
# | 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... |