# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448135 | JovanB | Broken Device (JOI17_broken_device) | C++17 | 40 ms | 2468 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>
using namespace std;
using ll = long long;
static const ll K = 626237348924392349LL;
static int radi[1005];
void Anna(int _n, long long X, int K, int P[] ){
int n = _n;
for(int i=0; i<n; i++) radi[i] = 1;
for(int i=0; i<K; i++) radi[P[i]] = 0;
if(K > 37){
for(int i=0; i<n; i++) Set(i, 1);
return;
}
X ^= K;
int j = 0;
for(int i=0; i<38; i++){
int treba = X%3;
X /= 3;
treba++;
for(;;){
if(treba/2 <= radi[j] && treba%2 <= radi[j+1]){
Set(j, treba/2);
Set(j+1, treba%2);
j += 2;
break;
}
Set(j, 0);
Set(j+1, 0);
j += 2;
}
}
while(j < n){
Set(j, 0);
j++;
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
static const ll K = 626237348924392349LL;
long long Bruno( int N, int A[] ){
int j = 0;
ll p3 = 1;
ll res = 0;
for(int i=0; i<38; i++){
int tr;
for(;;){
tr = 2*A[j] + A[j+1];
j += 2;
if(tr) break;
}
res += (tr-1)*p3;
p3 *= 3;
}
return res ^ K;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |