# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
546211 | blue | Broken Device 2 (JOI22_device2) | C++17 | 584 ms | 4560 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 <utility>
#include <vector>
#include <iostream>
using namespace std;
namespace {
int variable_example = 0;
using ll = long long;
const int bits = 60;
const int bs = 3;
}
int Declare() {
return bs * bits;
}
std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
vector<int> S, T;
for(int i = 0; i < bits*bs/2; i++)
{
S.push_back(0);
S.push_back(1);
}
ll pow2[bits];
pow2[0] = 1;
for(int e = 1; e < bits; e++)
pow2[e] = 2LL * pow2[e-1];
for(int i = 0; i < bits; i++)
{
for(int j = 0; j < bs; j++)
{
T.push_back(bool(A & pow2[i]));
}
}
for(int i = 0; i < bits*bs; i++) cerr << S[i];
cerr << '\n';
for(int i = 0; i < bits*bs; i++) cerr << T[i];
cerr << '\n';
return make_pair(S, T);
}
#include "Bruno.h"
#include <utility>
#include <vector>
#include <iostream>
using namespace std;
namespace {
int variable_example = 0;
using vi = vector<int>;
using ll = long long;
const int bits = 60;
const int bs = 3;
}
long long Bruno(vi u) {
int sm = 0;
ll res = 0;
ll cp = 1;
// cerr << "u = ";
// for(int k:u) cerr << k;
// cerr << '\n';
for(int i = 0; i < 2 * bits*bs; i++)
{
if(u[i] == 0) sm++;
else sm--;
// cerr << i << " : " << sm << '\n';
if(sm == bs)
{
cp *= 2;
sm -= bs;
// cerr << "+ detected\n";
}
else if(sm == -bs + 1)
{
res += cp;
// cerr << "adding " << cp << '\n';
cp *= 2;
sm += bs;
// cerr << "- detected\n";
}
}
// cerr << "returning " << res << '\n';
return res;
}
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... |