# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077432 | thelegendary08 | Broken Device (JOI17_broken_device) | C++14 | 32 ms | 3024 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>
#define f0r(i,n) for(int i = 0; i<n;i++)
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
using namespace std;
void Anna( int n, long long x, int k, int p[] ){
vector<bool>broken(n);
f0r(i, k){
broken[p[i]] = 1;
}
vb ret(n, 0);
long long mult = pow(3, 37);
vi v;
while(x > 0){
if(x >= mult * 2)v.pb(2);
else if(x >= mult)v.pb(1);
else v.pb(0);
x -= mult * v[v.size() - 1];
mult /= 3;
}
//for(auto u : v)cout<<u<<' ';
//cout<<'\n';
int ptr = 0;
f0r(i, 75){
if(broken[i*2] || broken[i*2+1] || ptr==v.size()){
ret[i*2] = 0;
ret[i*2+1] = 0;
}
else if(v[ptr] == 0){
ret[i*2] = 0;
ret[i*2+1] = 1;
}
else if(v[ptr] == 1){
ret[i*2] = 1;
ret[i*2+1] = 0;
}
else {
ret[i*2] = 1;
ret[i*2+1] = 1;
}
}
f0r(i, n){
Set(i, ret[i]);
}
}
#include "Brunolib.h"
#include<bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i<n;i++)
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
using namespace std;
long long Bruno( int n, int A[] ){
//for(int i = 0; i<N;i++)cout<<A[i]<<' ';
//cout<<'\n';
long long ret = 0;
long long cur = pow(3, 37);
f0r(i, 75){
if(A[i*2]== 1 && A[i*2+1] == 0){
ret += cur;
}
else if(A[i*2] == 1 && A[i*2+1] == 1){
ret += cur * 2;
}
cur/=3;
}
//cout<<ret;
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |