# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113949 | anayk | Broken Device (JOI17_broken_device) | C++14 | 2076 ms | 384 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 "Annalib.h"
#include <iostream>
#define LOGX 60
void Anna(int N, long long X, int K, int P[])
{
int bin[LOGX];
long long pow[LOGX];
pow[0] = 1;
for(int i = 1; i < LOGX; i++)
pow[i] = pow[i-1]*2;
for(int i = LOGX - 1; i >= 0; i++)
{
if(pow[i] <= X)
{
bin[i] = 1;
X -= pow[i];
}
else
bin[i] = 0;
}
int cur = 0;
int ptr = 0;
int next = 0;
while(ptr < 60)
{
if(P[next] - cur < 3)
{
Set(cur, 0);
cur++;
}
else
{
Set(cur, 1);
cur++;
for(int i = 0; i < 2; i++)
Set(cur++, bin[ptr++]);
}
if(P[next] < cur)
next++;
}
while(cur < N)
{
Set(cur, 0);
cur++;
}
}
#include "Brunolib.h"
#define LOGX 60
long long Bruno(int N, int A[])
{
long long pow[LOGX];
pow[0] = 1;
for(int i = 1; i < LOGX; i++)
pow[i] = pow[i-1]*2;
long long X = 0;
int cur = 0;
for(int i = 0; i < N; i++)
{
if(A[i] = 1)
{
for(int j = 0; j < 2; j++)
if(A[++i])
X += pow[cur++];
}
}
return X;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |