# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72671 | ikura355 | Broken Device (JOI17_broken_device) | C++14 | 63 ms | 5272 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;
#define ll long long
const int maxn = 150 + 5;
int bad[maxn], res[maxn];
int bit[65];
void Anna(int N, long long X, int K, int P[]) {
for(int i=0;i<N;i++) bad[i] = 0;
for(int i=0;i<K;i++) bad[P[i]] = 1;
for(int i=0;i<60;i++) bit[i] = (X&(1LL<<i)) ? 1 : 0;
for(int i=0;i<N;i++) res[i] = 0;
for(int x=1;x+60<N;x++) {
if(bad[x-1]) continue;
for(int y=x;y+60<N;y++) {
if(bad[y+60]) continue;
int good = 1;
for(int i=0;i<60;i++) {
if(bit[i] && bad[x+i] && bad[y+i]) good = 0;
}
if(good) {
// printf("Anna : x = %d y = %d\n",x,y);
for(int i=0;i<60;i++) {
res[x+i] = res[y+i] = bit[i];
}
res[x-1] = res[y+60] = 1;
for(int i=0;i<N;i++) Set(i,res[i]);
return ;
}
}
}
assert(0);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll Bruno(int N, int A[]) {
int x,y;
for(int i=0;i<N;i++) {
if(A[i]==1) {
x = i+1;
break;
}
}
for(int i=0;i<N;i++) {
if(A[i]==1) {
y = i-60;
}
}
ll ans = 0;
// printf("Bruno : x = %d y = %d\n",x,y);
for(int i=0;i<60;i++) {
ans += (1LL<<i) * (A[x+i]|A[y+i]);
}
// printf("ans = %lld\n",ans);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |