QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#519181#9168. Square Locatorucup-team1329WA 0ms3872kbC++142.3kb2024-08-14 17:07:502024-08-14 17:07:50

Judging History

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

  • [2024-08-14 17:07:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3872kb
  • [2024-08-14 17:07:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
// int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
// int dir[8][2] = {{1, 0}, {1, -1}, {1, 1}, {0, 1}, {0, -1}, {-1, 1}, {-1, 0}, {-1, -1}};
const int INF = 0x3f3f3f3f;
const double Pi = acos(-1);
__int128 sq(__int128 x) {
    __int128 l = 0, r = 3e9 + 10;
    while (r > 1 + l) {
        __int128 mid = (r + l) >> 1;
        if (mid * mid <= x)
            l = mid;
        else
            r = mid;
    }
    return l;
}

struct point {
    __int128 x, y;
    point clk90(point B) {
        __int128 dx = B.x - x;
        __int128 dy = B.y - y;
        return {x + dy, y - dx};
    }
    point anti_clk90(point B) {
        __int128 dx = B.x - x;
        __int128 dy = B.y - y;
        return {x - dy, y + dx};
    }
};
__int128 len2(point B) {
    return B.x * B.x + B.y * B.y;
}
point A,
    B, C, D;
__int128 d1, d2, d3, d4;
void check(__int128 L) {
    B.y = (d1 + d2 - L) / 2 / A.y;
    B.x = sq(d2 - B.y * B.y);
    C = B.clk90(A);
    D = C.clk90(B);
    if (len2(C) == d3 && len2(D) == d4) {
        cout << (ll)A.y << " " << (ll)B.x << " " << (ll)B.y << " ";
        cout << (ll)C.x << " " << (ll)C.y << " " << (ll)D.x << " " << (ll)D.y;
        exit(0);
    }
    B.x = -B.x;
    C = B.clk90(A);
    D = C.clk90(B);
    if (len2(C) == d3 && len2(D) == d4) {
        cout << (ll)A.y << " " << (ll)B.x << " " << (ll)B.y << " ";
        cout << (ll)C.x << " " << (ll)C.y << " " << (ll)D.x << " " << (ll)D.y;
        exit(0);
    }
}

void solve() {
    ll aa, bb, cc, dd;
    cin >> aa >> bb >> cc >> dd;
    d1 = aa, d2 = bb, d3 = cc, d4 = dd;
    A = {0, sq(aa)};
    __int128 a = 2;
    __int128 b = -2 * (d2 + d4);
    __int128 c = (2 * d1 * d1 + d2 * d2 + d4 * d4 - 2 * d1 * d2 - 2 * d1 * d4);
    __int128 temp = sq(b * b - 4 * a * c);
    __int128 x1 = (temp - b) / 2 / a;
    __int128 x2 = (-1 * temp - b) / 2 / a;
    check(x1);
    check(x2);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    // cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

详细

Test #1:

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

input:

36 5 10 41

output:

6 -2 1 3 -1 5 4

result:

ok Answer is correct

Test #2:

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

input:

1 1 1 1

output:

1 -1 0 0 -1 1 0

result:

ok Answer is correct

Test #3:

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

input:

1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000

output:


result:

wrong output format Unexpected end of file - int64 expected