QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#588929 | #6812. Draw a triangle | Sunlight9# | WA | 19ms | 3676kb | C++20 | 1.9kb | 2024-09-25 15:16:31 | 2024-09-25 15:16:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int t;
int main() {
cin.tie(nullptr) -> sync_with_stdio(false);
ll x1,x2,y1,y2,x3,y3;
cin>>t;
while(t--)
{
cin>>x1>>y1>>x2>>y2;
if(x1==x2)
{
cout<<x1+1LL<<" 1\n";
continue;
}
if(y1==y2)
{
cout<<"1 "<<y1+1LL<<'\n';
continue;
}
ll len_x,len_y,len;
len_x=abs(x2-x1);
len_y=abs(y2-y1);
ll gcdk=gcd(len_x,len_y);
len_x/=gcdk;len_y/=gcdk;
if(x1<x2)
{
if(y1<y2)
{
if(len_x<=len_y)
{
x3=x2;
y3=y2+1LL;
}
else
{
x3==x1-1LL;
y3=y1;
}
}
else
{
if(len_x<=len_y)
{
x3=x1;
y3=y1+1LL;
}
else
{
x3=x2+1LL;
y3=y2;
}
}
}
else
{
if(y1<y2)
{
if(len_x<=len_y)
{
x3=x2;
y3=y2+1LL;
}
else
{
x3=x1+1LL;
y3=y1;
}
}
else
{
if(len_x<=len_y)
{
x3=x1;
y3=y1+1LL;
}
else
{
x3=x2-1LL;
y3=y2;
}
}
}
cout<<x3<<' '<<y3<<'\n';
}
return 0;
}
详细
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 1 1 1 2 3
result:
ok T=3 (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 19ms
memory: 3676kb
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 43307635 98028994 -88895481 -3181030 -90319996 20018348 -56783508 84789440 -81798289 90628902 98942694 -939390 -42532402 -57203718 53499956 -30665847 27114803 46988893 -2657663 26865223 40613931 17923181 -47650155 96037473 92954044 -64535155 86508614 -51415402 -82017951 17392339 7...
result:
wrong answer wa on query #2 (test case 2)