Submission #359784

#TimeUsernameProblemLanguageResultExecution timeMemory
359784kshitij_sodanicmp (balkan11_cmp)C++14
64 / 100
3315 ms82556 KiB
//#pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long llo; #define mp make_pair #define pb push_back #define endl '\n' #include "cmp.h" void remember(int n) { //edit this int xx=0; for(int i=0;i<12;i++){ if(n&(1<<i)){ xx+=(1<<(11-i)); } } int nn=n; n=xx; int ind=1; for(int i=0;i<12;i+=2){ int cur=ind; if(n&(1<<i)){ cur+=2; } if(n&(1<<(i+1))){ cur+=1; } bit_set(cur); ind+=4; } /* if(co<=6){ for(int i=0;i<12;i++){ if(n&(1<<i)){ bit_set(i+2); } else{ } } } else{ bit_set(1); for(int i=0;i<12;i++){ if(n&(1<<i)){ } else{ bit_set(i+2); } } }*/ } bool check(int ind,int b){ int ask=0; for(int i=0;i<ind;i++){ ask+=(b&(1<<i)); } for(int i=0;i<ind-1;i++){ ask+=(1<<(i+1)); } return bit_get(ask+1); } int compare(int b) { //edit this int xx=0; for(int i=0;i<12;i++){ if(b&(1<<i)){ xx+=(1<<(11-i)); } } int bb=b; b=xx; int ind=1; for(int i=0;i<12;i+=2){ int ac=0; if(b&(1<<i)){ ac=2; } int bc=0; if(b&(1<<(i+1))){ bc=1; } if(bit_get(ind+ac+bc)==0){ /*if(bb==1822){ cout<<i<<endl; cout<<ac<<":"<<bc<<endl; }*/ if(bit_get(ind+(ac^2)+(bc))==1){ int cur=(ac^2)+bc; if(cur<ac+bc){ return 1; } return -1; } else if(bit_get(ind+(ac^2)+(bc^1))==1){ int cur=(ac^2)+(bc^1); if(cur<ac+bc){ return 1; } return -1; } else{ int cur=(ac)+(bc^1); if(cur<ac+bc){ return 1; } return -1; } } ind+=4; } return 0; /* int num=0; int ind=0; for(int i=3;i>=0;i--){ if((ind+(1<<i))>12){ continue; } if(check(ind+(1<<i),b)){ ind+=(1<<i); } }*/ /*if(bb==1268){ cout<<ind<<endl; }*/ if(ind==12){ return 0; } if(b&(1<<ind)){ return 1; } return -1; /*for(int i=2;i<=13;i++){ if(bit_get(i)){ num+=(1<<(i-2)); } } if(bit_get(1)){ num^=4095; } if(num>b){ return -1; } if(num==b){ return 0; }*/ return 1; }

Compilation message (stderr)

cmp.cpp: In function 'void remember(int)':
cmp.cpp:20:6: warning: unused variable 'nn' [-Wunused-variable]
   20 |  int nn=n;
      |      ^~
cmp.cpp: In function 'int compare(int)':
cmp.cpp:77:6: warning: unused variable 'bb' [-Wunused-variable]
   77 |  int bb=b;
      |      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...