QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#589017#6812. Draw a triangleSunlight9#WA 20ms3632kbC++201.4kb2024-09-25 15:43:232024-09-25 15:43:24

Judging History

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

  • [2024-09-25 15:43:24]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:3632kb
  • [2024-09-25 15:43:23]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using lll = __int128;

ll dx[] = {1, -1, 0, 0};
ll dy[] = {0, 0, 1, -1};

void solve() {
    ll x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    vector<array<lll, 3> > a;
    for (int i = 0; i < 4; ++i) {
        ll x = x1 + dx[i];
        ll y = y1 + dy[i];
        if (x != x1) {
            lll h = y2 - y;
            if (h != 0) {
                a.push_back({h, x, y});
            }
        } else {
            lll h = x2 - x;
            if (h) {
                a.push_back({h, x, y});
            }
        }
    }
    for (int i = 0; i < 4; ++i) {
        ll x = x2 + dx[i];
        ll y = y2 + dy[i];
        if (x != x2) {
            lll h = y1 - y;
            if (h != 0) {
                a.push_back({h, x, y});
            }
        } else {
            lll h = x1 - x;
            if (h) {
                a.push_back({h, x, y});
            }
        }
    }

    lll maxx = 0;
    ll ansx = 0, ansy = 0;
    for (int i = 0; i < ssize(a); ++i) {
        if (a[i][0] > maxx) {
            maxx = a[i][0];
            ansx = a[i][1];
            ansy = a[i][2];
        }
    }

    cout << ansx << " " << ansy << "\n";
}

int main() {
    cin.tie(nullptr) -> sync_with_stdio(false);

    int _;
    cin >> _;
    while (_--) solve();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 0 1 4
0 1 0 9
0 0 2 2

output:

2 0
1 1
1 0

result:

ok T=3 (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 20ms
memory: 3632kb

input:

50000
66620473 -33485015 66620223 -33485265
43307886 98029243 43307636 98028994
-88895230 -3180782 -88895480 -3181030
-90319745 20018595 -90319995 20018348
-56783257 84789686 -56783507 84789440
-81798038 90629147 -81798288 90628902
98942945 -939146 98942695 -939390
-42532151 -57203475 -42532401 -572...

output:

66620224 -33485265
43307636 98028995
-88895480 -3181029
-90319995 20018349
-56783507 84789441
-81798288 90628903
98942695 -939389
-42532401 -57203717
53499957 -30665846
27114804 46988894
-2657662 26865224
40613932 17923182
-47650154 96037474
92954045 -64535154
86508615 -51415401
-82017950 17392340
7...

result:

wrong answer wa on query #2 (test case 2)