Submission #23526

#TimeUsernameProblemLanguageResultExecution timeMemory
23526TAMREFcmp (balkan11_cmp)C++11
100 / 100
1959 ms82692 KiB
#include "cmp.h" const int sz=4; const int x[sz]={1,6,48,480},y[sz]={6,8,10,9},pos[sz]={10,30,50,70}; void remember(int n) { for(int i=sz-1;i>=0;--i){ bit_set(pos[i]+n/x[i]); n%=x[i]; } } int compare(int b) { int g[6]; for(int i=sz-1;i>=0;--i){ g[i]=b/x[i]; b%=x[i]; } for(int i=sz-1;i>=0;--i){ if(bit_get(pos[i]+g[i])){ //printf("i=%d, YAY!\n",i); continue; } if(g[i]>y[i]-g[i]-1){ for(int j=g[i]+1;j<y[i];j++) if(bit_get(pos[i]+j)) return -1; return 1; } else{ for(int j=g[i]-1;j>=0;--j) if(bit_get(pos[i]+j)) return 1; return -1; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...