# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100912 | Pro_ktmr | Broken Device (JOI17_broken_device) | C++14 | 66 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"
using namespace std;
#define LL long long
#define MP make_pair
#include"Annalib.h"
static vector<int> keta(LL X, int i){
vector<int> re;
while(X > 0){
re.push_back(X%i);
X /= i;
}
return re;
}
static LL make(vector<int> v, int i){
LL re = 0;
for(int j=v.size()-1; j>=0; j--){
re += i;
re += v[j];
}
return re;
}
//void Set(int pos, int bit)
//N=150
void Anna(int N, long long X, int K, int P[]){
bool canUse[150];
for(int i=0; i<N; i++) canUse[i] = true;
for(int i=0; i<K; i++) canUse[P[i]] = false;
vector<int> tmp = keta(X, 3);
LL now = 0;
for(int i=0; i+1<N; i+=2){
if(now < tmp.size() && canUse[i] && canUse[i+1]){
if(tmp[now] == 0){
Set(i, 0);
Set(i+1, 1);
}
if(tmp[now] == 1){
Set(i, 1);
Set(i+1, 0);
}
if(tmp[now] == 2){
Set(i, 1);
Set(i+1, 1);
}
now++;
}
else{
Set(i, 0);
Set(i+1, 0);
}
}
}
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#include"Brunolib.h"
static vector<int> keta(LL X, int i){
vector<int> re;
while(X > 0){
re.push_back(X%i);
X /= i;
}
return re;
}
static LL make(vector<int> v, int i){
LL re = 0;
for(int j=v.size()-1; j>=0; j--){
re += i;
re += v[j];
}
return re;
}
long long Bruno(int N, int A[]){
vector<int> ans;
for(int i=0; i+1<N; i+=2){
if(A[i] == 0 && A[i+1] == 1){
ans.push_back(0);
}
if(A[i] == 1 && A[i+1] == 0){
ans.push_back(1);
}
if(A[i] == 1 && A[i+1] == 1){
ans.push_back(2);
}
}
return make(ans,3);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |