# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1247364 | MateiKing80 | 비교 (balkan11_cmp) | C++20 | 612 ms | 102332 KiB |
#include "cmp.h"
#include <bits/stdc++.h>
using namespace std;
int gib(int x, int bit) {
if (x & (1 << bit))
return 1;
return 0;
}
const int bulan = 4096;
void remember(int a) {
a += bulan;
while (a) {
bit_set(a);
a = (a - 1) / 4;
}
}
int compare(int b) {
b += bulan;
vector<int> nrs;
while (b) {
nrs.push_back(b);
b = (b - 1) / 4;
}
int pos = -1;
for (int pas = 16; pas; pas >>= 1)
if (pos + pas < (int)nrs.size() && !bit_get(nrs[pos + pas]))
pos += pas;
if (pos == -1)
return 0;
vector<int> v(4);
int x = ((b - 1) / 4) * 4 + 1;
v[b - x] ++;
if (b == x)
return -1;
if (b == x + 1)
return bit_get(x) ? 1 : -1;
if (b == x + 2)
return bit_get(x + 3) ? -1 : 1;
if (b == x + 3)
return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |