# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077360 | thelegendary08 | Broken Device (JOI17_broken_device) | C++17 | 35 ms | 2884 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);
vb v;
f0r(i, 60){
v.pb((1LL<<i) & x);
}
//for(auto u : v)cout<<u<<' ';
//cout<<'\n';
int i = 0;
int ptr = 0;
while(i < n-3 && ptr < 60){
if(!broken[i] && !broken[i+1] && !broken[i+2] && !broken[i+3]){
ret[i] = 1;
ret[i+1] = v[ptr];
ret[i+2] = v[ptr + 1];
ret[i+3] = v[ptr + 2];
ptr += 3;
i += 4;
}
else i++;
}
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;
vb ans;
int ptr = 0;
while(ptr < n - 2){
if(A[ptr] == 1){
ans.pb(A[ptr + 1]);
ans.pb(A[ptr + 2]);
ans.pb(A[ptr + 3]);
ptr += 4;
}
else ptr++;
}
f0r(i, ans.size()){
ret += ans[i] * (1LL << i);
}
cout<<ret;
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |