# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
503437 |
2022-01-08T01:00:55 Z |
bang627 |
cmp (balkan11_cmp) |
C++14 |
|
1415 ms |
82408 KB |
#include "cmp.h"
#include <iostream>
using namespace std;
void remember(int a) {
int cnt = 10240,cnt2=0, copy_a = a;
while (a > 0) {
if (a % 2==1) cnt2++;
a >>= 1;
}
a = copy_a;
//if(a==1023) cout << cnt2 << endl;
if (cnt2 > 6) bit_set(1);
while (cnt>=10229) {
if (a % 2==1 && cnt2 <= 6) bit_set(cnt);
if (a % 2==0 && cnt2 > 6) bit_set(cnt);
a /= 2;
cnt--;
}
}
int compare(int b) {
bool inv = false;
if (bit_get(1) == 1) {
inv = true;
//cout << "hi";
}
for (int i = 10240 - 12 + 1, cnt = 11; i <= 10240; i++, cnt--) {
int a_val = bit_get(i);
if (inv) a_val = 1 - a_val;
if (a_val == 1 && (b >> cnt) % 2 == 0) {
//cout << b << endl;
//cout << i << " " << cnt << " " << a_val << " " << inv << endl;
return -1;
}
if (a_val == 0 && (b >> cnt) % 2 == 1) return 1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1415 ms |
82408 KB |
Output is partially correct - maxAccess = 19, score = 19 |