# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
568833 |
2022-05-26T08:48:12 Z |
Jomnoi |
cmp (balkan11_cmp) |
C++17 |
|
0 ms |
208 KB |
#include <bits/stdc++.h>
#include "cmp.h"
using namespace std;
void remember(int n) {
vector <int> digits;
while(n > 0) {
digits.push_back(n % 4);
n /= 4;
}
while(digits.size() < 6) {
digits.push_back(0);
}
reverse(digits.begin(), digits.end());
int base4 = 0;
for(int i = 0; i < 6; i++) {
base4 *= 4;
base4 += digits[i];
bit_set(base4);
}
}
int compare(int b) {
vector <int> digits;
while(b > 0) {
digits.push_back(b % 4);
b /= 4;
}
while(digits.size() < 6) {
digits.push_back(0);
}
reverse(digits.begin(), digits.end());
int base4;
int l = 0, r = 6;
while(l < r) {
int mid = (l + r) / 2;
base4 = 0;
for(int i = 0; i < mid; i++) {
base4 *= 4;
base4 += digits[i];
}
if(bit_get(base4)) {
l = mid;
}
else {
r = mid - 1;
}
}
if(l == 6) {
return 0;
}
base4 = 0;
for(int i = 0; i < l; i++) {
base4 *= 4;
base4 += digits[i];
}
if(digits[l] >= 2) {
base4 *= 4;
base4 += 3;
if(bit_get(base4)) {
return -1;
}
return 1;
}
else {
base4 *= 4;
if(bit_get(base4)) {
return 1;
}
return -1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
ZERO POINTS: bit_set with addr out of range 0 |