QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#269247 | #6812. Draw a triangle | ucup-team1001# | WA | 40ms | 3680kb | C++23 | 744b | 2023-11-29 14:15:43 | 2023-11-29 14:15:43 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0);
#define x1 jdfhnskjsdnbflj
#define y1 bhfgrbsw
#define int long long
int exgcd(int a, int b, int &x, int &y) {
if (b == 0) {
x = 1, y = 0;
return a;
}
int d = exgcd(b, a % b, x, y);
int temp = x;
x = y;
y = temp - a / b * y;
return d;
}
void solve() {
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
int a = y2 - y1;
int b = x1 - x2;
int c = x2 * y1 - y2 * x1;
int x,y;
int d = exgcd(a,b,x,y);
x*=(-c+d)/d;
y*=(-c+d)/d;
cout<<x<<" "<<y<<endl;
}
signed main() {
IOS
int t = 1;
cin >> t;
while (t--)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
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: 0
Accepted
time: 24ms
memory: 3680kb
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:
0 -100105487 13723647137 13723647137 10625410771 10625410771 -2267030938412 -2239717312648 -1090149184320 -1072566132960 8539561213 8539561213 -511914166638 -499725734099 424314498206 412417830032 319508495863 309201770190 -578593658835 -557743436895 735414464 735414464 -475560039227 -454656301239 3...
result:
ok T=50000 (50000 test cases)
Test #3:
score: 0
Accepted
time: 20ms
memory: 3616kb
input:
50000 57869123 -31462316 57868973 -31462566 -22048649 -27017563 -22048799 -27017812 80245618 -10283113 80245468 -10283361 -96265076 -90677482 -96265226 -90677729 22392625 4659329 22392475 4659083 -85852423 89101455 -85852573 89101210 -59733414 34194238 -59733564 34193994 -64971121 90615380 -64971271...
output:
-383732562 -767465124 1437479154 2395798590 -278763942756 -461032674558 172989475041 284923841244 8817758411 14429059218 75677936158 123836622804 -78816354856 -128076576641 -205662025800 -332976613200 241510584310 389533200500 938919977092 1508428815656 -271531094 -407296641 -696880821473 -111028469...
result:
ok T=50000 (50000 test cases)
Test #4:
score: 0
Accepted
time: 31ms
memory: 3628kb
input:
50000 -4816480 -62927672 -4816530 -62927922 38837454 51846136 38837404 51845887 81700780 -17769080 81700730 -17769328 -2355821 -67457821 -2355871 -67458068 38958908 -79915945 38958858 -79916191 -22432180 -56740626 -22432230 -56740871 -30176805 95059932 -30176855 95059688 -42037280 55545124 -42037330...
output:
0 -38845271 -7078219245 -35391096225 -10575123719 -52875618595 -47447055454 -234444274008 81478131720 400600814290 531770561 2658852805 -48464548072 -236264671851 -90946206673 -441738718126 -19983343602 -96586160743 139544142287 672349049201 -1457322350 -7286611750 -89345914470 -426874924690 1265746...
result:
ok T=50000 (50000 test cases)
Test #5:
score: 0
Accepted
time: 40ms
memory: 3612kb
input:
50000 47565990 63314613 47566040 63314364 -6671692 -8431430 -6671642 -8431678 -56437314 67409796 -56437264 67409549 -19754631 97449419 -19754581 97449173 22709358 -65094552 22709408 -65094797 -9253477 92786383 -9253427 92786139 60264780 -99332277 60264830 -99332520 42759753 13104536 42759803 1310429...
output:
-15009662161 75048310805 1038075557 -5190377785 179681954869 -887840247588 76990356 -378535917 -461813023 2309065115 9525883056 -46438679898 67744093837 -329042741494 33009261084 -159544761906 -174847788115 842448433645 -2199586039 10997930195 -62832387006 300199182362 23538925692 -111809897037 -361...
result:
ok T=50000 (50000 test cases)
Test #6:
score: 0
Accepted
time: 24ms
memory: 3648kb
input:
49999 86077178 -33791178 86077328 -33791427 70274103 92949056 70274253 92948808 -98644776 -36717042 -98644626 -36717289 -58640982 -37021140 -58640832 -37021386 47389280 88658595 47389430 88658350 41133739 -18298063 41133889 -18298307 16742668 91602345 16742818 91602102 64705012 76220813 64705162 762...
output:
-16364540625 27274234375 -407814367298 674462222839 507837871507 -836438847188 -36627896371 59936557698 -54800158281 89672986278 29167691472 -47397498642 124661740539 -201833294206 419921890268 -677293371400 -205443052534 330056051612 -1983420338 2975130507 1052833967444 -1677396490504 140764926942 ...
result:
ok T=49999 (49999 test cases)
Test #7:
score: -100
Wrong Answer
time: 29ms
memory: 3620kb
input:
50000 -370035325 -480207325 197507381 563102266 -447653163 -13791299 712913474 279375990 -164085901 515918101 -746049282 520422889 -351774171 -526736185 986786085 570845376 -139080671 -314883129 -653624395 -401153986 371330972 295281720 716532063 406617905 713639850 932579042 -697994312 -837319029 -...
output:
3037602965586551130 -3684686650043747596 -5940222706546725131 7328769955173378296 -8091520802762528876 -6524082570765958290 271553885506210670 -8788859978097958324 -5352538833438176300 -8752062590085771056 -5785223905983955414 -5386530194414199123 6152380926142574003 -7835917720491488415 32575507191...
result:
wrong answer Integer parameter [name=x3] equals to 3037602965586551130, violates the range [-10^18, 10^18] (test case 1)