QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#629554 | #9168. Square Locator | chie4 | WA | 0ms | 3696kb | C++14 | 768b | 2024-10-11 13:11:50 | 2024-10-11 13:11:51 |
Judging History
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;
}
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: 3576kb
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: 3684kb
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: 3696kb
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]