답안 #223095

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
223095 2020-04-14T18:16:44 Z dolphingarlic 비교 (balkan11_cmp) C++14
100 / 100
1921 ms 96120 KB
#include "cmp.h"
int d[6]{1,4097,5121,5377,5441,5457};void remember(int n){for(int i=0;i<6;i++)bit_set((n>>i*2)+d[i]);}int compare(int b){int l=0,r=6;while(l!=r){int m=(l+r)/2;if(bit_get((b>>m*2)+d[m]))r=m;else l=m+1;}if(!l)return 0;int g=(b>>l*2-2)&3;if(g>1){if(bit_get((((b>>l*2)<<2)+3)+d[l-1]))return -1;return 1;}else{if(bit_get(((b>>l*2)<<2)+d[l-1]))return 1;return -1;}}

Compilation message

cmp.cpp: In function 'int compare(int)':
cmp.cpp:2:230: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
 int d[6]{1,4097,5121,5377,5441,5457};void remember(int n){for(int i=0;i<6;i++)bit_set((n>>i*2)+d[i]);}int compare(int b){int l=0,r=6;while(l!=r){int m=(l+r)/2;if(bit_get((b>>m*2)+d[m]))r=m;else l=m+1;}if(!l)return 0;int g=(b>>l*2-2)&3;if(g>1){if(bit_get((((b>>l*2)<<2)+3)+d[l-1]))return -1;return 1;}else{if(bit_get(((b>>l*2)<<2)+d[l-1]))return 1;return -1;}}
                                                                                                                                                                                                                                   ~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1921 ms 96120 KB Output is correct - maxAccess = 10, score = 100