# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
566799 | 2022-05-22T21:24:58 Z | Deepesson | 비교 (balkan11_cmp) | C++17 | 4858 ms | 104940 KB |
#include <bits/stdc++.h> #include "cmp.h" void bit_set(int addr); int bit_get(int addr); void remember(int n) { std::vector<int> vec; while(n){ vec.push_back(n&1); n/=2; } while(vec.size()<12) vec.push_back(0); std::reverse(vec.begin(),vec.end()); int base=1; for(int i=0;i!=vec.size();++i){ base*=2; base+=vec[i]; bit_set(base+1); } } int compare(int b) { std::vector<int> vec; while(b){ vec.push_back(b&1); b/=2; } while(vec.size()<12) vec.push_back(0); std::reverse(vec.begin(),vec.end()); int l=0,r=12; while(l<r){ int m = (l+r+1)/2; int base=1; for(int i=0;i<m;++i){ base*=2; base+=vec[i]; } int x = bit_get(base+1); if(x){ l=m; }else r=m-1; } ///Sao iguais if(l==12){ return 0; } ///Eh maior if(vec[l]){ return 1; } ///Eh menor return -1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 4858 ms | 104940 KB | Output is partially correct - maxAccess = 16, score = 46 |