QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#402406#6812. Draw a triangleStarrykiller#RE 1ms3648kbC++23755b2024-04-30 15:19:312024-04-30 15:19:32

Judging History

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

  • [2024-04-30 15:19:32]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3648kb
  • [2024-04-30 15:19:31]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long 


int exgcd(int a, int b, int &x, int &y) {
    if (!b) return x=1, y=0, abs(a);
    int d=exgcd(b,a%b,x,y);
    int z=x; x=y, y=z-y*(a/b);
    return d;
}

void solve() {
    int x1, y1, x2, y2;
    cin>>x1>>y1>>x2>>y2;
    if (x1==x2) {
        cout<<x1+1<<' '<<y1<<'\n';
        return;
    }
    if (y1==y2) {
        cout<<x1<<' '<<y1+1<<'\n';
        return;
    }
    int x=x2-x1, y=y2-y1;
    int a, b;
    int g=exgcd(y,x,a,b);
    assert(a*y+b*x==g);
    cout<<x1+a<<' '<<y1-b<<'\n';
    // 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int T; cin>>T;
    while (T--) solve();
    
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3648kb

input:

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

output:

2 0
1 1
0 -1

result:

ok T=3 (3 test cases)

Test #2:

score: -100
Runtime Error

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:


result: