QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#635566#6812. Draw a trianglesazhiWA 15ms3660kbC++201.5kb2024-10-12 20:10:342024-10-12 20:10:35

Judging History

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

  • [2024-10-12 20:10:35]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:3660kb
  • [2024-10-12 20:10:34]
  • 提交

answer

// author:  jieda
// file:	cpp
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
# define fi first
# define se second
# define all(x) x.begin(),x.end()
# define stst stringstream
# define pb push_back
# define pf push_front
# define pp push
# define lowbit(x) (x)&(-x)
# define fa(i,op,n) for (int i = op; i <= n; i++)
# define fb(j,op,n) for (ll j = op; j >= n; j--)
# define fg(i,op,n) for (ll i = op; i != n; i = ne[i])
int dx[4] = {-1,0,1,0},dy[4] = {0,1,0,-1};
typedef unsigned long long  ull;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
const int N = 599999,INF = 0x3f3f3f3f,mod = 1000000007;
const ll MOD = 212370440130137957ll;//hash(hight)
const int base = 131;
const double eps = 1e-10;
const int seed=10086,mo=1e6+7; //hash(lower)
int prime = 233317;
using namespace std;
ll exgcd(ll a,ll b,ll &x,ll &y)
{
    if(!b) 
    {
        x = 1,y = 0;
        return a;
    }
    ll d = exgcd(b,a%b,y,x);
    y-=a/b*x;
    return d;
}
void solve(){
	ll x2,y2,x3,y3;cin>>x2>>y2>>x3>>y3;
	ll x,y;
	if(x3-x2==0||(y3-y2) == 0){
		if(x3-x2 == 0){
			cout<<x2+1<<' '<<y2<<'\n';
		}else{
			cout<<y2+1<<' '<<x2<<'\n';
		}
	}else{
		ll d = exgcd(-(y3-y2),x3-x2,x,y);
		cout<<x+x2<<' '<<y+y2<<'\n';
	}
	return ;
}

int main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int t = 1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
/**/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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
Wrong Answer
time: 15ms
memory: 3660kb

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 #251 (test case 251)