# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1032161 |
2024-07-23T12:34:22 Z |
amine_aroua |
cmp (balkan11_cmp) |
C++17 |
|
0 ms |
0 KB |
//#include "cmp.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> delta = {1, 4097, 5100, 5400, 5500, 5600};
int pow4(int n , int i )
{
return (n >> (2 * i));
}
void remember(int n) {
for(int i = 0 ; i < 6 ; i++)
{
bit_set(pow4(n , i)+delta[i]);
}
}
int compare(int b)
{
int lo = 0 , hi = 7;
while(lo + 1 < hi)
{
int mid = (lo + hi)/2;
if(bit_get(delta[mid - 1] + pow4(b , mid - 1)))
hi = mid;
else
lo = mid;
}
hi--;
if(hi == 0)
{
return 0;
}
int nb = 4 * pow4(b , hi);
int bit = pow4(b , hi - 1) - nb;
for(int i = 0 ; i < 4 ; i++)
{
if(i == bit)
continue;
if(bit_get(delta[hi - 1] + nb + i))
{
if(i < bit)
{
return 1;
}
else
return -1;
}
}
}
Compilation message
cmp.cpp: In function 'void remember(int)':
cmp.cpp:12:9: error: 'bit_set' was not declared in this scope; did you mean 'tzset'?
12 | bit_set(pow4(n , i)+delta[i]);
| ^~~~~~~
| tzset
cmp.cpp: In function 'int compare(int)':
cmp.cpp:22:12: error: 'bit_get' was not declared in this scope
22 | if(bit_get(delta[mid - 1] + pow4(b , mid - 1)))
| ^~~~~~~
cmp.cpp:38:12: error: 'bit_get' was not declared in this scope
38 | if(bit_get(delta[hi - 1] + nb + i))
| ^~~~~~~
cmp.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
48 | }
| ^