QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#629559#9168. Square Locatorchie4WA 0ms3640kbC++14772b2024-10-11 13:13:192024-10-11 13:13:20

Judging History

你现在查看的是最新测评结果

  • [2024-10-11 13:13:20]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3640kb
  • [2024-10-11 13:13:19]
  • 提交

answer

#include <cmath>
#include <cstdlib>
#include <iostream>

long long binary_search_sqrt(long long x) {
    long long l = 0;
    long long r = x + 1;
    long long m;
    while (l != r - 1) {
        m = (l + r) >> 1;
        if (m * m <= x) l = m;
        else r = m;
    }
    return l+0.5;
}

int main() {
    long long oa, ob, oc, od;
    std::cin >> oa >> ob >> oc >> od;

    oa = binary_search_sqrt(oa);
    long long cx, cy, bx, by, dx, dy;
    cx = std::abs((ob - od) / (2 * oa));
    cy = binary_search_sqrt(oc - cx * cx);
    bx = (oa - cy - cx) / -2;
    by = (oa + cy - cx) >> 1;
    dx = cx - bx;
    dy = by + cx;
    std::cout << oa << " " << bx << " " << by << " " << cx << " " << cy << " "
              << dx << " " << dy;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3572kb

input:

36 5 10 41

output:

6 -1 2 3 1 4 5

result:

ok Answer is correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

1 1 1 1

output:

1 0 1 0 1 0 1

result:

ok Answer is correct

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3640kb

input:

1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000

output:

52636401108727944 0 52636401108727944 0 52636401108727944 0 52636401108727944

result:

wrong answer Integer parameter [name=A_y] equals to 52636401108727944, violates the range [-10^9, 10^9]