# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077270 | LCJLY | Broken Device (JOI17_broken_device) | C++14 | 32 ms | 2624 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>
//#include "grader.cpp"
using namespace std;
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << " " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << " " << j << " " << i << " " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
void Anna(int n, long long val, int k, int p[]){
bool amos[155];
memset(amos,0,sizeof(amos));
for(int x=0;x<k;x++){
amos[p[x]]=true;
}
//[0,30)
//[30,60)
vector<int>v;
for(int x=0;x<60;x++){
if(val&(1LL<<x)) v.push_back(1);
else v.push_back(0);
}
int ptr=0;
for(int x=0;x<n;x+=2){
if(ptr<(int)v.size()&&x+2<n&&!amos[x]&&!amos[x+2]){
Set(x,1);
Set(x+2,v[ptr]);
ptr++;
x+=2;
}
else Set(x,0);
}
for(int x=1;x<n;x+=2){
if(ptr<(int)v.size()&&x+2<n&&!amos[x]&&!amos[x+2]){
Set(x,1);
Set(x+2,v[ptr]);
ptr++;
x+=2;
}
else Set(x,0);
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << " " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << " " << j << " " << i << " " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
long long Bruno(int n, int a[]){
long long val=0;
int cur=0;
for(int x=0;x<n;x+=2){
if(a[x]==1){
if(a[x+2]==1){
val+=1LL<<cur;
}
cur++;
x+=2;
}
}
for(int x=1;x<n;x+=2){
if(a[x]==1){
if(a[x+2]==1){
val+=1LL<<cur;
}
cur++;
x+=2;
}
}
return val;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |