# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
339073 | nandonathaniel | cmp (balkan11_cmp) | C++14 | 2180 ms | 102380 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cmp.h"
#include "bits/stdc++.h"
using namespace std;
int A[6];
void remember(int n) {
//tambah 1 di depan, supaya bisa dibedain
//partisi 3,2,2,2,2,2
n^=(1<<12);
//yang di set prefixnya
bit_set((n & (7<<10))>>10);
bit_set((n & (31<<8))>>8);
bit_set((n & (127<<6))>>6);
bit_set((n & (511<<4))>>4);
bit_set((n & (2047<<2))>>2);
bit_set(n & 8191);
}
int compare(int a) {
a^=(1<<12);
A[0]=(a & (7<<10))>>10;
A[1]=(a & (31<<8))>>8;
A[2]=(a & (127<<6))>>6;
A[3]=(a & (511<<4))>>4;
A[4]=(a & (2047<<2))>>2;
A[5]=a & 8191;
//cari pertama yang beda
int ki=0,ka=6;
while(ki<ka){
int mid=(ki+ka)/2;
if(bit_get(A[mid])){
ki=mid+1;
}
else ka=mid;
}
if(ki==6){
//sama semua
return 0;
}
int sama;
if(ki==0)sama=4;
else sama=A[ki-1]<<2;
if((A[ki] & 3)==0)return -1;
else if((A[ki] & 3)==1){
if(bit_get(sama))return 1;
else return -1;
}
else if((A[ki] & 3)==2){
if(bit_get(sama^3))return -1;
else return 1;
}
else return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |