Submission #1077424

#TimeUsernameProblemLanguageResultExecution timeMemory
1077424LCJLYBroken Device (JOI17_broken_device)C++14
85 / 100
30 ms3180 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; while(val>0){ v.push_back(val%3); val/=3; } int ptr=0; for(int x=0;x<n;x+=2){ if(amos[x]||amos[x+1]){ Set(x,0); Set(x+1,0); } else if(ptr==(int)v.size()){ Set(x,0); Set(x+1,0); } else{ if(v[ptr]==0){ Set(x,0); Set(x+1,1); } else if(v[ptr]==1){ Set(x,1); Set(x+1,0); } else{ Set(x,1); Set(x+1,1); } ptr++; } } }
#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; long long take=1; for(int x=0;x<n;x+=2){ if(a[x]==0&&a[x+1]==0) continue; else{ int cur=0; if(a[x]==1&&a[x+1]==0) cur=1; if(a[x]==1&&a[x+1]==1) cur=2; val=val+cur*take; take*=3; } } return val; }
#Verdict Execution timeMemoryGrader output
Fetching results...