Submission #1077156

#TimeUsernameProblemLanguageResultExecution timeMemory
1077156LCJLYBroken Device (JOI17_broken_device)C++14
8 / 100
38 ms2924 KiB
#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; } vector<int>v; int bit=0; for(int x=0;x<60;x++){ if(val&(1LL<<x)){ v.push_back(1); bit++; } else v.push_back(0); } if(bit<=30){ int ptr=0; for(int x=0;x<n;x++){ if(ptr<(int)v.size()&&x!=n-1&&!amos[x]&&!amos[x+1]){ Set(x,1); Set(x+1,v[ptr]); x++; ptr++; } else Set(x,0); } } else{ for(int x=0;x<60;x++) v[x]=!v[x]; int ptr=0; bool take=false; for(int x=0;x<n;x++){ if(ptr<(int)v.size()&&x!=n-1&&!amos[x]){ if(v[ptr]==0){ Set(x,1); Set(x+1,0); ptr++; x++; } else if(v[ptr]==1&&!amos[x+1]){ Set(x,1); Set(x+1,1); x++; ptr++; } else Set(x,0); } else if(ptr==(int)v.size()&&!take&&!amos[x]){ take=true; Set(x,1); } 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++) cout << a[x] << " "; //cout << endl; for(int x=0;x<n;x++){ if(a[x]==1){ if(a[x+1]==1){ val+=1LL<<cur; } cur++; x++; } } //cout << "check" << endl; if(cur==61){ val=(1LL<<60)-val-1; } return val; }
#Verdict Execution timeMemoryGrader output
Fetching results...