# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
480791 |
2021-10-18T04:28:50 Z |
Rainbowbunny |
cmp (balkan11_cmp) |
C++17 |
|
1793 ms |
96024 KB |
#include "cmp.h"
#include <bits/stdc++.h>
using namespace std;
int a[] = {4, 16, 64, 256, 1024, 4096};
void remember(int n)
{
int tmp = 0;
for(int i = 10; i >= 0; i -= 2)
{
bit_set((n >> i) + tmp + 1);
tmp += a[(10 - i) / 2];
}
}
int compare(int b)
{
int l = 0, r = 6;
while(l < r)
{
int mid = (l + r) >> 1;
int z = (5 - mid) * 2;
int tmp = 0;
for(int i = 10; i > z; i -= 2)
{
tmp += a[(10 - i) / 2];
}
if(bit_get((b >> z) + tmp + 1))
{
l = mid + 1;
}
else
{
r = mid;
}
}
if(l == 6)
{
return 0;
}
else
{
int z = (5 - l) * 2;
int tmp = 0;
for(int i = 10; i > z; i -= 2)
{
tmp += a[(10 - i) / 2];
}
int ttt = (b >> z) & 3;
if(ttt == 0)
{
return -1;
}
else if(ttt == 3)
{
return 1;
}
else if(ttt == 2)
{
if(bit_get((b >> z) + 2 + tmp))
{
return -1;
}
else
{
return 1;
}
}
else if(ttt == 1)
{
if(bit_get((b >> z) + tmp))
{
return 1;
}
else
{
return -1;
}
}
}
}
Compilation message
cmp.cpp: In function 'int compare(int)':
cmp.cpp:83:1: warning: control reaches end of non-void function [-Wreturn-type]
83 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1793 ms |
96024 KB |
Output is correct - maxAccess = 10, score = 100 |