#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define ll long long int
const int N = 2e5+100;
namespace {
int variable_example = 0;
}
int Declare() {
variable_example++;
return 2000;
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
vi X, Y;
for(int i = 0; i < 90; ++i){
X.pb(0);
X.pb(1);
}
for(ll i = 0; i < 60; ++i){
for(int j = 0; j < 3; ++j){
Y.pb(((1ll<<i)&A) ? 1 : 0);
}
}
return make_pair(X, Y);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define ll long long int
const int N = 2e5+100;
namespace {
int variable_example = 0;
}
long long Bruno(std::vector<int> u) {
vector<int> sum;
vi pref(u.size());
pref[0] = u[0] == 1 ? -1 : 1;
for(int i = 1; i < u.size(); ++i){
pref[i] = pref[i - 1] + (u[i] ? -1 : 1);
}
// for(int x: pref) cerr << x << ' ';
// cerr << '\n';
vi st;
for(int x: pref){
int val = (x+300000000)%3;
// cerr << x << ' ' << val << '\n';
if(val==0 || val==1){
int dv = (x >= 0 ? x / 3 : (x-2)/3);
if(st.empty() || st.back() != dv)
st.pb(dv);
}
}
if(st[0] == 0) st.erase(st.begin());
// for(int x: st) cerr << x << ' ';
// cerr << st.size() << " f\n";
vi D;
D.pb(st[0]);
for(int i = 1; i < st.size(); ++i){
D.pb(st[i] - st[i - 1]);
}
ll ans = 0;
for(ll i = 0; i < 60 ;++i){
// cerr << D[i] << ' ';
ans += (1ll<<i)*(D[i] == 1 ? 0 : 1);
}
return ans;
}
# | 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... |