Submission #205040

# Submission time Handle Problem Language Result Execution time Memory
205040 2020-02-27T18:03:45 Z alexandra_udristoiu cmp (balkan11_cmp) C++14
100 / 100
1814 ms 82552 KB
#include<iostream>
#include "cmp.h"
using namespace std;
int v[] = {0, 10, 10, 8, 6};
int p[] = {0, 4800, 480, 48, 6, 1};
int t[] = {0, 1, 11, 21, 29};
void remember(int a){
    for(int i = 4; i >= 1; i--){
        int x = a / p[i + 1] % v[i];
        bit_set(x + t[i]);
    }
}
int compare(int b){
    int i, x, st, dr, pos;
    for(i = 1; i <= 4; i++){
        x = b / p[i + 1] % v[i];
        if(bit_get(x + t[i]) == 0){
            break;
        }
    }
    if(i == 5){
        return 0;
    }
    pos = t[i];
    st = 0;
    dr = v[i] - 1;
    if(x - st < dr - x){
        for(i = st; i < x; i++){
            if(bit_get(i + pos) == 1){
                return 1;
            }
        }
        return -1;
    }
    else{
        for(i = dr; i > x; i--){
            if(bit_get(i + pos) == 1){
                return -1;
            }
        }
        return 1;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1814 ms 82552 KB Output is correct - maxAccess = 10, score = 100