Submission #928605

#TimeUsernameProblemLanguageResultExecution timeMemory
928605Yazan_SAcmp (balkan11_cmp)C++14
19 / 100
3121 ms107036 KiB
#include "cmp.h" #include <iostream> #include <algorithm> #include <string> using namespace std; string toby(int x) { string s=""; while(x) { s+=x%2?"1":"0"; x/=2; } while(s.size()<13) s+="0"; if(count(s.begin(),s.end(),'1')>6) for(auto &c:s) c=(c=='0'?'1':'0'); reverse(s.begin(),s.end()); return s; } void remember(int a) { string s=toby(a); for(int i=0; i<13; i++) if(s[i]=='1') bit_set(i+1); } int compare(int b) { string s=""; for(int i=1; i<=13; i++) s.push_back(bit_get(i)+'0'); reverse(s.begin(),s.end()); int ac=0; if(s[12]=='1') for(auto &c:s) c=(c=='0'?'1':'0'); for(int i=0; i<12; i++) if(s[i]=='1') ac+=(1<<i); if(ac>b) return -1; if(ac<b) return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...