Submission #848972

#TimeUsernameProblemLanguageResultExecution timeMemory
848972abcvuitunggiocmp (balkan11_cmp)C++17
100 / 100
1139 ms106476 KiB
#include "cmp.h" int num[4]={0,8,72,584}; void remember(int n){ for (int i=0;i<4;i++) bit_set((n>>(i*3))+num[3-i]+1); } int compare(int b) { int l=0,r=3,kq=0; while (l<=r){ int mid=(l+r)>>1; if (bit_get((b>>(9-mid*3))+num[mid]+1)) l=kq=mid+1; else r=mid-1; } if (kq==4) return 0; b>>=(9-kq*3); if (b%8<4){ for (int i=0;i<b%8;i++) if (bit_get(b/8*8+i+num[kq]+1)) return 1; return -1; } for (int i=b%8+1;i<8;i++) if (bit_get(b/8*8+i+num[kq]+1)) return -1; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...