# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
23524 |
2017-05-12T09:13:19 Z |
TAMREF |
cmp (balkan11_cmp) |
C++11 |
|
2090 ms |
82768 KB |
#include "cmp.h"
const int sz=5;
const int x[sz]={1,3,15,105,945},y[sz]={3,5,7,9,5},pos[sz]={10,30,50,70,90};
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(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 |
2090 ms |
82768 KB |
Output is partially correct - maxAccess = 11, score = 91 |