# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
21130 | khsoo01 | Broken Device (JOI17_broken_device) | C++11 | 65 ms | 3736 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;
bool cant[155];
void Anna( int N, long long X, int K, int P[] ){
for(int i=0;i<N;i++) cant[i] = false;
for(int i=0;i<K;i++) cant[P[i]] = true;
vector<int> tri;
long long T = X;
for(int i=0;i<38;i++) {
tri.push_back(T%3+1);
T /= 3;
}
reverse(tri.begin(), tri.end());
int idx = 0;
for(int i=0;i<N;i+=2) {
if(cant[i] || cant[i+1] || idx >= tri.size()) {
Set(i, 0); Set(i+1, 0);
}
else {
Set(i, tri[idx]/2); Set(i+1, tri[idx]%2);
idx++;
}
}
}
#include "Brunolib.h"
long long Bruno( int N, int A[] ){
long long ret = 0;
for(int i=0;i<N;i+=2) {
int cur = A[i] * 2 + A[i+1];
if(!cur) continue;
ret *= 3; ret += cur-1;
}
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |