QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#738312#6812. Draw a triangleAmiyaCast#WA 15ms3712kbC++20813b2024-11-12 18:38:162024-11-12 18:38:20

Judging History

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

  • [2024-11-12 18:38:20]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:3712kb
  • [2024-11-12 18:38:16]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
void exgcd(int a, int b, int &x, int &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return;
    }
    exgcd(b, a % b, x, y);
    int t = y;
    y = x - (a / b) * y, x = t;
}
void solve()
{
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a = (y1 - y2), b = (x2 - x1);
    if (a == 0) 
    {
        cout << 0 << ' ' << y1 + 1 << '\n';
        return; 
    }
    else if (b == 0)
    {
        cout << x1 + 1 << ' ' << 0 << '\n';
        return;
    }
    if (a < b) swap(a, b);
    int x, y;
    exgcd(a, b, x, y);
    cout << x + x1 << ' ' << y + y1 << '\n';
}
signed main()
{
    ios::sync_with_stdio(0); cin.tie(0), cout.tie(0);
    int t; cin >> t;
    while (t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

2 0
1 0
0 1

result:

ok T=3 (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 15ms
memory: 3712kb

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:

66620473 -33485014
43307887 98029244
-88895229 -3180781
-90319662 20018677
-56783195 84789747
-81798037 90629148
98942987 -939105
-42532044 -57203371
53500238 -30665575
27115165 46989241
-2657411 26865464
40614273 17923507
-47649883 96037731
92954372 -64534845
86508883 -51415149
-82017683 17392590
7...

result:

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