# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
718843 |
2023-04-05T01:07:00 Z |
lam |
cmp (balkan11_cmp) |
C++14 |
|
1514 ms |
96040 KB |
#include "cmp.h"
#include <bits/stdc++.h>
using namespace std;
int delta[6] = {1,4097,5121,5377,5441,5457};
void remember(int n) {
for (int i=0; i<6; i++) bit_set(delta[i] + (n>>(2*i)));
}
bool get(int x)
{
// cerr<<x<<endl;
assert(x>0);
return bit_get(x);
}
int compare(int b) {
int l=0; int r=5;
int ans = -1;
while (l<=r)
{
int mid=(l+r)/2;
// if (b==234)
// {
//// cerr<<mid<<' '<<b<<endl;
//// int temp = ((b>>(2*mid))); cerr<<temp<<"!!"<<endl;
//
// }
if (get((b>>(2*mid))+delta[mid])) r=mid-1;
else
{
ans=mid;
l=mid+1;
}
}
if (ans==-1) return 0;
int digit = (b>>(2*ans))&3;
// if (b==234)
// {
//
// cerr<<ans<<endl;
// int x=b;
// while (x>0)
// {
// cerr<<(x&3); x>>=2;
// }
// cerr<<endl;
// x=3723;
// while (x>0)
// {
// cerr<<(x&3); x>>=2;
// }
// cerr<<endl;
// cerr<<" = ";
// cerr<<digit<<endl;
// }
if (digit>1)
{
if (get(((b>>(2*ans+2))<<2) + 3 + delta[ans])) return -1;
else return 1;
}
else
{
// cerr<<ans<<' '<<delta[ans]<<endl;
// int val = ((b>>(2*ans+2))<<2) + delta[ans]; cerr<<val<<endl;
if (get(((b>>(2*ans+2))<<2) + delta[ans])) return 1;
else return -1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1514 ms |
96040 KB |
Output is correct - maxAccess = 10, score = 100 |