# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1154591 | thelegendary08 | Broken Device (JOI17_broken_device) | C++17 | 20 ms | 1524 KiB |
#include "Annalib.h"
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
vector<bool>broken(N);
for(int i = 0; i<K; i++){
broken[P[i]] = 1;
}
vector<int>digits;
while(X != 0){
digits.pb(X % 3);
X /= 3;
}
int ptr = 0;
for(int i = 0; i<N; i+=2){
if(broken[i] || broken[i+1]){
Set(i, 0);
Set(i+1, 0);
}
else{
if(ptr != digits.size()){
if(digits[ptr] == 0){
Set(i, 0);
Set(i+1, 1);
}
else if(digits[ptr] == 1){
Set(i, 1);
Set(i+1, 0);
}
else{
Set(i, 1);
Set(i+1, 1);
}
ptr++;
}
else{
Set(i, 0);
Set(i+1, 0);
}
}
}
}
#include "Brunolib.h"
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
long long Bruno( int N, int A[] ){
vector<int>digits;
for(int i = 0; i<N; i+=2){
if(A[i] == 0 && A[i+1] == 1){
digits.pb(0);
}
else if(A[i] == 1 && A[i+1] == 0)digits.pb(1);
else if(A[i] == 1 && A[i+1] == 1)digits.pb(2);
}
long long int cur = 1;
long long int ans = 0;
for(auto u : digits){
ans += u * cur;
cur *= 3;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |