# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23526 | TAMREF | cmp (balkan11_cmp) | C++11 | 1959 ms | 82692 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |