Submission #370161

#TimeUsernameProblemLanguageResultExecution timeMemory
370161arnold518cmp (balkan11_cmp)C++14
46 / 100
9078 ms105068 KiB
#include "cmp.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int A, B; void remember(int _A) { A=_A; vector<int> V; for(int i=11; i>=0; i--) { if(A&(1<<i)) V.push_back(1); else V.push_back(0); } int val=0; for(int i=0; i<V.size(); i++) { val=val*2+V[i]; int t=(1<<(i+1))-1; bit_set(t+val); } } int compare(int _B) { B=_B; vector<int> V, VV; for(int i=11; i>=0; i--) { if(B&(1<<i)) V.push_back(1); else V.push_back(0); } int val=0; for(int i=0; i<V.size(); i++) { val=val*2+V[i]; VV.push_back(val); } int lo=-1, hi=12; while(lo+1<hi) { int mid=lo+hi>>1; int t=(1<<(mid+1))-1; if(bit_get(t+VV[mid])) lo=mid; else hi=mid; } if(hi==12) return 0; if(V[hi]) return 1; else return -1; }

Compilation message (stderr)

cmp.cpp: In function 'void remember(int)':
cmp.cpp:22:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for(int i=0; i<V.size(); i++)
      |               ~^~~~~~~~~
cmp.cpp: In function 'int compare(int)':
cmp.cpp:42:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  for(int i=0; i<V.size(); i++)
      |               ~^~~~~~~~~
cmp.cpp:52:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   52 |   int mid=lo+hi>>1;
      |           ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...