Submission #23523

# Submission time Handle Problem Language Result Execution time Memory
23523 2017-05-12T09:09:16 Z TAMREF cmp (balkan11_cmp) C++11
82 / 100
2381 ms 82832 KB
#include "cmp.h"
const int x[6]={1,2,8,48,384,3840},y[6]={2,4,6,8,10,2},pos[6]={10,30,50,70,90,110};
void remember(int n) {
    for(int i=5;i>=0;--i){
        bit_set(pos[i]+n/x[i]);
        n%=x[i];
    }
}

int compare(int b) {
    int g[6];
    for(int i=5;i>=0;--i){
        g[i]=b/x[i];
        b%=x[i];
    }
    for(int i=5;i>=0;--i){
        if(bit_get(pos[i]+g[i])){
            //printf("i=%d, YAY!\n",i);
            continue;
        }
        if(2*(g[i]+1)>y[i]){
            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
1 Partially correct 2381 ms 82832 KB Output is partially correct - maxAccess = 12, score = 82