# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131756 | zoooma13 | Broken Device (JOI17_broken_device) | C++14 | 46 ms | 3312 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 "bits/stdc++.h"
#include "Annalib.h"
using namespace std;
pair<int ,int> en(int num){
if(num == 2) return {1 ,1};
if(num == 1) return {1 ,0};
return {0 ,1};
}
void Anna(int N ,long long X ,int K ,int P[]){
//srand(1);
vector <int> ord(N);
iota(ord.begin() ,ord.end() ,0);
//random_shuffle(ord.begin() ,ord.end());
vector <bool> bad(N, 0);
for(int i=0; i<K; i++)
bad[P[i]] = true;
vector <bool> enc(N);
for(int i=0; i<N; i+=2){
auto d = en(X%3);
if((!bad[ord[i]] || !d.first) && (!bad[ord[i+1]] || !d.second)){
enc[ord[i]] = d.first;
enc[ord[i+1]] = d.second;
X /= 3;
}
}
for(int i=0; i<N; i++)
Set(i ,enc[i]);
}
#include "bits/stdc++.h"
#include "Brunolib.h"
using namespace std;
int de(pair<int ,int> p){
return p.first+p.second == 2 ? 2 : p.first;
}
long long Bruno(int N ,int A[]){
//srand(1);
vector <int> ord(N);
iota(ord.begin() ,ord.end() ,0);
//random_shuffle(ord.begin() ,ord.end());
long long X = 0LL ,pw = 1LL;
for(int i=0; i<N; i+=2)
if(A[ord[i]] || A[ord[i+1]]){
X += pw*de({A[ord[i]] ,A[ord[i+1]]});
pw *= 3;
}
return X;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |