# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
928605 | Yazan_SA | 비교 (balkan11_cmp) | C++14 | 3121 ms | 107036 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |