# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1034327 |
2024-07-25T12:24:11 Z |
vjudge1 |
cmp (balkan11_cmp) |
C++17 |
|
426 ms |
82512 KB |
#include "cmp.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
const int N = 4096;
mt19937 rng(time(nullptr) + 69);
void remember(int a) {
int x = __builtin_popcount(a);
if (x <= 1 + 12-x) {
for (int i = 0; i <= 11; i++) {
if ((a >> i) & 1) bit_set(i+1);
}
}
else {
bit_set(13);
for (int i = 0; i <= 11; i++) {
if (!((a >> i) & 1)) bit_set(i+1);
}
}
}
int compare(int b) {
vector<int> bt(12);
for (int i = 0; i < 12; i++) {
bt[i] = i;
}
shuffle(all(bt), rng);
int inv = bit_get(13);
int mask = 0;
for (int i = 0; i < 11; i++) {
int x = bit_get(bt[i]+1);
if (inv) x = !x;
if (x) mask ^= (1 << bt[i]);
}
if (mask > b) return -1;
else if (mask == b) return 0;
else return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
426 ms |
82512 KB |
ZERO POINTS: For a=1938 and b=1811, correct answer is -1, got 1 |