# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70663 | Inovak | Broken Device (JOI17_broken_device) | C++14 | 73 ms | 4064 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 <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define ll long long
#define OK puts("OK");
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
using namespace std;
int u[1000];
void Anna( int N, long long X, int K, int P[] ) {
int cnt = 0, cn = 0;
int l = 0;
while((1ll << l) <= X) l++;
for(int i = 0; i < K; i++)
u[P[i]] = 1;
for( int i = 0; i < N - 1; i++) {
if(u[i] || u[i + 1] || cnt >= l) {
Set(i, 0);
cn++;
}
else {
Set(i, 1);
Set(i + 1, ((X & (1ll << cnt)) ? 1 : 0));
cn += 2;
cnt++;
i++;
}
}
if(cn < N)
Set(N - 1, 0);
}
#include "Brunolib.h"
long long Bruno( int N, int A[] ) {
long long cnt = 0;
long long X = 0;
for(int i = 0; i < N - 1; i++) {
if(A[i] == 1 && A[i + 1] == 1) {
X += (1ll << cnt);
cnt++;
i++;
}
else if(A[i] == 1) {
cnt++;
i++;
}
}
return X;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |