# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100093 | oolimry | Broken Device (JOI17_broken_device) | C++14 | 67 ms | 3328 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;
void Anna( int N, long long X, int K, int P[] ){
set<int> bad;
for(int i = 0;i < K;i++){
bad.insert(P[i]);
}
int ter[38];
for(int i = 0;i < 38;i++){
ter[i] = X % 3ll;
X /= 3ll;
//cout << ter[i] << " ";
}
//cout << "\n";
int c = 0;
for(int i = 0;i < N;i++){
if(i % 2 == 0) continue;
else{
if(bad.find(i) != bad.end() || bad.find(i-1) != bad.end()){
Set(i,0);
Set(i-1,0);
}
else{
if(c == 38){
Set(i-1,0);
Set(i,0);
}
else{
if(ter[c] == 0){
Set(i-1,0);
Set(i,1);
}
else if(ter[c] == 1){
Set(i-1,1);
Set(i,0);
}
else{
Set(i-1,1);
Set(i,1);
}
c++;
}
}
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
long long Bruno( int N, int A[] ){
long long ans = 0ll;
int ter[38];
int c = 0;
for(int i = 0;i < N;i++){
if(i % 2 == 0) continue;
else{
int a = A[i-1];
int b = A[i];
if(a == 0 && b == 0){
continue;
}
else{
if(a == 0 && b == 1){
ter[c] = 0;
}
else if(a == 1 && b == 0){
ter[c] = 1;
}
else{
ter[c] = 2;
}
c++;
}
}
}
for(int i = 0;i < 38;i++){
//ter[i] = X % 3;
// X /= 3;
//cout << ter[i] << " ";
}
for(int i = 37;i >= 0;i--){
ans *= 3ll;
ans += (long long)ter[i];
}
//cout << "\n" << ans;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |