Submission #718843

#TimeUsernameProblemLanguageResultExecution timeMemory
718843lam비교 (balkan11_cmp)C++14
100 / 100
1514 ms96040 KiB
#include "cmp.h" #include <bits/stdc++.h> using namespace std; int delta[6] = {1,4097,5121,5377,5441,5457}; void remember(int n) { for (int i=0; i<6; i++) bit_set(delta[i] + (n>>(2*i))); } bool get(int x) { // cerr<<x<<endl; assert(x>0); return bit_get(x); } int compare(int b) { int l=0; int r=5; int ans = -1; while (l<=r) { int mid=(l+r)/2; // if (b==234) // { //// cerr<<mid<<' '<<b<<endl; //// int temp = ((b>>(2*mid))); cerr<<temp<<"!!"<<endl; // // } if (get((b>>(2*mid))+delta[mid])) r=mid-1; else { ans=mid; l=mid+1; } } if (ans==-1) return 0; int digit = (b>>(2*ans))&3; // if (b==234) // { // // cerr<<ans<<endl; // int x=b; // while (x>0) // { // cerr<<(x&3); x>>=2; // } // cerr<<endl; // x=3723; // while (x>0) // { // cerr<<(x&3); x>>=2; // } // cerr<<endl; // cerr<<" = "; // cerr<<digit<<endl; // } if (digit>1) { if (get(((b>>(2*ans+2))<<2) + 3 + delta[ans])) return -1; else return 1; } else { // cerr<<ans<<' '<<delta[ans]<<endl; // int val = ((b>>(2*ans+2))<<2) + delta[ans]; cerr<<val<<endl; if (get(((b>>(2*ans+2))<<2) + delta[ans])) return 1; else return -1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...