Submission #1219755

#TimeUsernameProblemLanguageResultExecution timeMemory
1219755gvancakBroken Device (JOI17_broken_device)C++20
0 / 100
19 ms1600 KiB
#include "Annalib.h" #include <bits/stdc++.h> #define f first #define s second #define pb push_back #define mp make_pair #define ll long long using namespace std; void Anna( int N, long long X, int K, int P[] ){ ll n=N,a[1500],x; ll ind1,ind2; for (int i=0; i<n; i++) a[i]=0; for (int i=0; i<K; i++){ a[P[K]]=1; } ll y=1; for( int i = 0; i < N; i+=3 ){ x=a[i]+a[i+1]+a[i+2]; if (x>=2){ Set( i, 0 ); Set( i+1, 0 ); Set( i+2, 0 ); continue; } if (x==0){ if (((1<<y)&X)==0) ind1=0; else ind1=1; y*=2; if (((1<<y)&X)==0) ind2=0; else ind2=1; y*=2; if (ind1==0 && ind2==0){ Set( i, 0 ); Set( i+1, 1 ); Set( i+2, 1 ); continue; } if (ind1==0 && ind2==1){ Set( i, 0 ); Set( i+1, 1 ); Set( i+2, 0 ); continue; } if (ind1==1 && ind2==0){ Set( i, 1 ); Set( i+1, 0 ); Set( i+2, 1 ); continue; } if (ind1==1 && ind2==1){ Set( i, 1 ); Set( i+1, 1 ); Set( i+2, 1 ); continue; } } if (x==1){ if (((1<<y)&X)==0) ind1=0; else ind1=1; y*=2; if (((1<<y)&X)==0) ind2=0; else ind2=1; y*=2; if (a[i]==1){ if (ind1==1){ y/=2; Set( i, 0 ); Set( i+1, 0 ); Set( i+2, 1 ); continue; } if (ind1==0 && ind2==0){ Set( i, 0 ); Set( i+1, 1 ); Set( i+2, 1 ); continue; } if (ind1==0 && ind2==1){ Set( i, 0 ); Set( i+1, 1 ); Set( i+2, 0 ); continue; } } if (a[i+1]==1){ y/=2; if (ind1==1){ Set( i, 0 ); Set( i+1, 0 ); Set( i+2, 1 ); continue; } if (ind1==0 ){ Set( i, 1 ); Set( i+1, 0 ); Set( i+2, 0 ); continue; } } if (a[i+2]==1){ y/=2; if (ind1==1){ Set( i, 1 ); Set( i+1, 1 ); Set( i+2, 0 ); continue; } if (ind1==0 ){ Set( i, 1 ); Set( i+1, 0 ); Set( i+2, 0 ); continue; } } } } }
#include "Brunolib.h" #include <bits/stdc++.h> #define f first #define s second #define pb push_back #define mp make_pair #define ll long long using namespace std; long long Bruno( int N, int A[] ){ ll a1,a2,a3; string s=""; for (int i=0; i<N; i+=3){ a1=A[i]; a2=A[i+1]; a3=A[i+2]; if (a1==0 && a2==0 && a3==1){ s+='1'; } if (a1==0 && a2==1 && a3==0){ s+='0'; s+='1'; } if (a1==0 && a2==1 && a3==1){ s+='0'; s+='0'; } if (a1==1 && a2==0 && a3==0){ s+='0'; } if (a1==1 && a2==0 && a3==1){ s+='1'; s+='0'; } if (a1==1 && a2==1 && a3==0){ s+='1'; } if (a1==1 && a2==1 && a3==1){ s+='1'; s+='1'; } } reverse(s.begin(),s.end()); ll z=1,ans=0; for (int i=0; i<s.size(); i++){ if (s[i]=='1') ans+=z; z*=2; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...