제출 #1322110

#제출 시각아이디문제언어결과실행 시간메모리
1322110KhoaDuycmp (balkan11_cmp)C++20
100 / 100
1063 ms93032 KiB
#include "cmp.h" #include<bits/stdc++.h> using namespace std; #define endl '\n' void remember(int x){ int pre[12]; pre[9]=0; for(int i=9;i>0;i-=3){ pre[i-3]=pre[i]+(1<<(12-i)); } for(int i=9;i>=0;i-=3){ bit_set((x>>i)+pre[i]+1); } } int compare(int x){ int pre[12]; pre[9]=0; for(int i=9;i>0;i-=3){ pre[i-3]=pre[i]+(1<<(12-i)); } if(bit_get(pre[0]+x+1)){ return 0; } int low=0,high=3; while(low<high){ int mid=((low+high+1)>>1); if(bit_get(1+pre[3*mid]+(x>>(3*mid)))){ high=mid-1; } else{ low=mid; } } int bst=3*high; x>>=bst; if((x%8)<=3){ while((x%8)!=0){ x--; if(bit_get(pre[bst]+x+1)){ return 1; } } return -1; } else{ while((x%8)!=7){ x++; if(bit_get(pre[bst]+x+1)){ return -1; } } return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...