QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#55505#4865. Symmetry: ConvexJunoAC ✓213ms34512kbC++173.9kb2022-10-14 10:31:342022-10-14 10:31:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-14 10:31:35]
  • 评测
  • 测评结果:AC
  • 用时:213ms
  • 内存:34512kb
  • [2022-10-14 10:31:34]
  • 提交

answer

#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}

const ll INF=9e18;

struct point {
	using T=ll;
	T x,y;
	point(){}
	point(T x,T y):x(x),y(y){}
	bool operator==(point b)const{return x==b.x&&y==b.y;}
	point operator+(point b)const{return point(x+b.x,y+b.y);}
	point operator-(point b)const{return point(x-b.x,y-b.y);}
	T operator*(point b)const{return x*b.x+y*b.y;}
	T operator/(point b)const{return x*b.y-y*b.x;}
	bool operator<(point b)const{return y==b.y?x<b.x:y<b.y;}
	inline int sgn(){return y<0||(y==0&&x<0);}
	inline ll norm(){return x*x+y*y;}
};

int n;
point v[300010];

pll a[600010];
int pr[600010];

vector<pair<pll,ll>> ans;

void manacher() {
	int len=2*n+1;
	int p=-1,r=-1;
	for(int i=0;i<len;i++) {
		if(i<=r)pr[i]=min(pr[2*p-i],r-i);
		else pr[i]=0;
		while(i-pr[i]-1>=0&&i+pr[i]+1<len&&a[i-pr[i]-1]==a[i+pr[i]+1])pr[i]++;
		if(r<i+pr[i])r=i+pr[i],p=i;
	}
}

bool is_palindrome(int l,int r) {
	int m=(l+r)/2;
	m=m*2+1;
	if((r-l)%2)m++;
	return m-pr[m]<=2*l+1;
}

void add_perpen_line(int i,int j) {
	point d=v[i]-v[j];
	ll a=2*d.x;
	ll b=2*d.y;
	ll c=-(v[i].x*v[i].x-v[j].x*v[j].x)-(v[i].y*v[i].y-v[j].y*v[j].y);
	ans.pb({{a,b},c});
}

void add_line(int i,int j) {
	point d=v[j]-v[i];
	d.y=-d.y;
	swap(d.x,d.y);
	ll a=d.x;
	ll b=d.y;
	ll c=v[i].x*v[j].y-v[j].x*v[i].y;
	ans.pb({{a,b},c});
}

bool has_equal_sides(int i) {
	int j=(i-1+n)%n;
	int k=(i+1)%n;
	return (v[j]-v[i]).norm()==(v[k]-v[i]).norm();
}

pll get_prod(int i,int j,int k) {
	return {(v[k]-v[j])*(v[i]-v[j]),(v[k]-v[j])/(v[i]-v[j])};
}

void MAIN() {
	cin>>n;
	for(int i=0;i<n;i++) {
		cin>>v[i].x>>v[i].y;
	}
	v[n]=v[0];

	for(int i=0;i<n;i++) {
		int j=(i-1+n)%n;
		int k=(i+1)%n;
		a[2*i]={INF,INF};
		a[2*i+1]=get_prod(j,i,k);
	}
	a[2*n]={INF,INF};

	manacher();

	map<pll,vector<int>> mp;
	pll a1=get_prod(0,1,2);
	mp[a1]={1};

	for(int i=2;i<n;i++) {
		ans.clear();
		pll a0=get_prod(i,0,1);
		pll ai=get_prod(i-1,i,0);
		if(mp.count(a0)) {
			vector<int>& lst=mp[a0];
			for(int j:lst) {
				pll ak;
				if(j+1==i)ak=get_prod(j,j+1,0);
				else ak=get_prod(j,j+1,j+2);
				if(ai==ak&&(j==1||is_palindrome(1,j-1))&&(i<=j+2||is_palindrome(j+2,i-1))) {
					if(j%2||has_equal_sides(j/2)) {
						add_perpen_line(0,j);
					}
				}
			}
		}
		if(ai==a0&&is_palindrome(1,i-1)) {
			add_perpen_line(0,i);
		}
		if(ai==a1&&(i==2||is_palindrome(2,i-1))&&(v[i]-v[0]).norm()==(v[1]-v[0]).norm()) {
			if(i%2)add_line(0,(i+1)/2);
			else add_perpen_line(i/2,i/2+1);
		}
		cout<<sz(ans)<<'\n';
		for(auto& it:ans) {
			cout<<it.fi.fi<<' '<<it.fi.se<<' '<<it.se<<'\n';
		}

		pll p=get_prod(i-1,i,i+1);
		if(!mp.count(p)) {
			mp[p]={i};
		} else {
			mp[p].pb(i);
		}
	}
}

int main() {
	ios::sync_with_stdio(false);cin.tie(0);

	int T;cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 5616kb

input:

3
4
0 0
1 0
1 1
0 1
3
0 0
3 0
1 1
4
-1000000000 -1000000000
1000000000 -1000000000
1000000000 1000000000
-1000000000 1000000000

output:

1
-2 -2 2
4
-2 0 1
-2 -2 2
0 -2 1
-1 1 0
0
1
-4000000000 -4000000000 0
4
-4000000000 0 0
-4000000000 -4000000000 0
0 -4000000000 0
-2000000000 2000000000 0

result:

ok 3 test cases (3 test cases)

Test #2:

score: 0
Accepted
time: 2ms
memory: 5616kb

input:

1
4
0 0
1 0
2 2
1 2

output:

0
0

result:

ok 1 test cases (1 test case)

Test #3:

score: 0
Accepted
time: 68ms
memory: 5716kb

input:

100000
3
0 0
137 967
-137 967
3
613 141
-613 141
0 0
3
0 0
165 58
-165 58
3
971 78
-971 78
0 0
3
627 119
-627 119
0 0
3
-252 233
0 0
252 233
3
0 0
193 11
-193 11
3
73 4
-73 4
0 0
3
0 0
464 613
-464 613
3
0 0
559 461
-559 461
3
0 0
760 61
-760 61
3
0 0
196 865
-196 865
3
386 825
-386 825
0 0
3
0 0
14...

output:

1
548 0 0
1
2452 0 0
1
660 0 0
1
3884 0 0
1
2508 0 0
1
-1008 0 0
1
772 0 0
1
292 0 0
1
1856 0 0
1
2236 0 0
1
3040 0 0
1
784 0 0
1
1544 0 0
1
576 0 0
1
1760 0 0
1
-1796 0 0
1
-3624 0 0
1
-376 0 0
1
-1484 0 0
1
988 0 0
1
28 0 0
1
3612 0 0
1
1196 0 0
1
164 0 0
1
1460 0 0
1
-1708 0 0
1
-1192 0 0
1
236 0...

result:

ok 100000 test cases (100000 test cases)

Test #4:

score: 0
Accepted
time: 94ms
memory: 5632kb

input:

10000
4
170 161
271 406
-271 406
-170 161
6
289 21
1110 317
1939 1184
-1939 1184
-1110 317
-289 21
38
-6784 4727
-6207 3806
-5861 3357
-5837 3328
-5714 3192
-5479 2933
-4682 2141
-4467 1929
-3773 1260
-3154 778
-2808 557
-1856 322
-1811 311
-1610 268
-713 77
713 77
1610 268
1811 311
1856 322
2808 55...

output:

0
1
680 0 0
0
0
0
1
1156 0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
-27136 0 0
0
0
0
0
0
0
0
1
-27136 0 0
0
0
0
0
0
0
0
0
0
1
-3996 0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
-16072 0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
-16072 0 0
1
-652 0 0
0
1
37...

result:

ok 10000 test cases (10000 test cases)

Test #5:

score: 0
Accepted
time: 103ms
memory: 5824kb

input:

1000
314
46083 29898
46580 30642
47116 31453
47426 31924
47556 32123
48163 33066
48250 33202
48644 33831
48678 33886
48756 34013
49159 34681
49399 35082
49902 35924
50395 36779
50574 37126
50643 37265
50911 37818
51302 38632
51615 39301
51950 40032
52331 40871
52634 41562
52653 41606
52655 41611
528...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
184332 0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 1000 test cases (1000 test cases)

Test #6:

score: 0
Accepted
time: 136ms
memory: 7008kb

input:

100
1300
-107115 35842
-106336 35343
-105957 35102
-105776 34987
-104828 34386
-104561 34217
-104263 34030
-103904 33805
-103053 33277
-102454 32906
-102117 32699
-101193 32140
-100252 31573
-99601 31184
-99166 30925
-99090 30880
-98743 30675
-98012 30246
-97561 29985
-97125 29734
-96838 29569
-9591...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100 test cases (100 test cases)

Test #7:

score: 0
Accepted
time: 166ms
memory: 11388kb

input:

10
36250
2650050 772825
2650918 773332
2651132 773457
2652053 773995
2652373 774182
2653001 774549
2653066 774587
2653526 774856
2654256 775283
2655027 775734
2655374 775937
2656244 776446
2656338 776501
2656649 776683
2657288 777057
2657329 777081
2657756 777331
2658444 777734
2658753 777915
265899...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 10 test cases (10 test cases)

Test #8:

score: 0
Accepted
time: 213ms
memory: 34512kb

input:

1
300000
-61217516 50928980
-61217337 50928367
-61217304 50928254
-61217146 50927713
-61217021 50927285
-61216778 50926453
-61216627 50925936
-61216568 50925734
-61216339 50924950
-61216254 50924659
-61216058 50923988
-61215810 50923139
-61215673 50922670
-61215647 50922581
-61215498 50922071
-61215...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #9:

score: 0
Accepted
time: 49ms
memory: 15220kb

input:

1
99999
218789668 -30062233
218794627 -30062475
218801690 -30062819
218806557 -30063056
218816411 -30063535
218824584 -30063932
218833009 -30064340
218838547 -30064608
218842640 -30064806
218851370 -30065228
218859212 -30065606
218863641 -30065819
218873133 -30066275
218880895 -30066647
218887844 -3...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #10:

score: 0
Accepted
time: 63ms
memory: 16204kb

input:

1
100000
82919048 -59332292
82916010 -59318408
82914444 -59311256
82910724 -59294272
82906424 -59274644
82902060 -59254728
82901298 -59251252
82897114 -59232174
82893492 -59215662
82891602 -59207046
82888736 -59193982
82885472 -59179104
82881702 -59161920
82879974 -59154046
82876596 -59138654
828753...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #11:

score: 0
Accepted
time: 60ms
memory: 15388kb

input:

1
99999
-402380358 -107427468
-402383014 -107437774
-402386031 -107449481
-402389658 -107463560
-402393296 -107477692
-402397214 -107492914
-402400465 -107505547
-402403082 -107515718
-402407128 -107531454
-402410352 -107543998
-402411755 -107549457
-402413647 -107556819
-402417630 -107572336
-40242...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #12:

score: 0
Accepted
time: 54ms
memory: 16300kb

input:

1
99999
-303286690 188419090
-303288556 188407794
-303290704 188394790
-303293491 188377917
-303296036 188362506
-303297724 188352282
-303300256 188336940
-303301127 188331657
-303303320 188318354
-303304980 188308280
-303307691 188291827
-303309017 188283775
-303310881 188272455
-303312454 18826290...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #13:

score: 0
Accepted
time: 50ms
memory: 13428kb

input:

1
100000
-10515521 -377619713
-10509191 -377606643
-10504546 -377597052
-10499572 -377586780
-10493113 -377573441
-10487726 -377562314
-10483280 -377553130
-10480829 -377548067
-10477885 -377541985
-10474544 -377535082
-10469084 -377523800
-10464369 -377514055
-10459797 -377504605
-10453394 -3774913...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #14:

score: 0
Accepted
time: 58ms
memory: 12364kb

input:

1
100000
52134468 -112136157
52140143 -112126841
52145705 -112117709
52148858 -112112532
52154331 -112103544
52155916 -112100941
52160349 -112093660
52164990 -112086037
52168996 -112079457
52174143 -112070999
52178665 -112063568
52181149 -112059485
52185995 -112051519
52188699 -112047073
52191836 -1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #15:

score: 0
Accepted
time: 57ms
memory: 12432kb

input:

1
100000
-42856709 -331300887
-42853910 -331295570
-42849395 -331286993
-42843271 -331275359
-42836605 -331262695
-42831066 -331252172
-42826574 -331243638
-42820731 -331232537
-42819105 -331229447
-42817184 -331225796
-42810718 -331213504
-42803978 -331200688
-42798459 -331190191
-42792064 -3311780...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #16:

score: 0
Accepted
time: 52ms
memory: 12436kb

input:

1
100000
-304306010 128978426
-304297926 128971488
-304290350 128964986
-304284535 128959997
-304275510 128952254
-304268400 128946154
-304259046 128938132
-304248614 128929186
-304239900 128921714
-304234563 128917139
-304224983 128908927
-304217392 128902424
-304208887 128895143
-304200925 1288883...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #17:

score: 0
Accepted
time: 1ms
memory: 5616kb

input:

1
100
435910464 -369900640
435846544 -369903376
435797504 -369906496
435556432 -369927280
435277168 -369960656
434997792 -370000896
434763392 -370060352
434668832 -370093472
434493872 -370155216
434336096 -370240384
434160144 -370335856
434132736 -370357024
434022656 -370448224
433917664 -370539584
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
5748096 5748096 -362910501482496
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
-4447168 4447168 3593466007363584
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2
5748096 5748096 -362910501482496
-444...

result:

ok 1 test cases (1 test case)

Test #18:

score: 0
Accepted
time: 0ms
memory: 5624kb

input:

1
20
302599125 132311481
334130200 195340566
346755856 283587898
334163265 352929811
302658642 415972122
239636170 479021046
176607085 510552121
88359753 523177777
19017840 510585186
-44024471 479080563
-107073395 416058091
-138604470 353029006
-151230126 264781674
-138637535 195439761
-107132912 13...

output:

0
1
-63128280 -441236660 127151980712776960
0
0
1
251984080 -756481280 182780972274616880
0
0
0
0
1
882407190 -441435050 34768119726149950
0
0
0
0
1
567360960 188988060 -107284483726405560
0
0
4
-63062150 -126058170 40728368822061370
251984080 -756481280 182780972274616880
882407190 -441435050 34768...

result:

ok 1 test cases (1 test case)

Test #19:

score: 0
Accepted
time: 2ms
memory: 5608kb

input:

1
36
283484898 -47733438
301706406 -27263790
337025352 33021084
345972264 58924416
352998720 92181888
355387878 128156202
347378370 188909778
324660582 245822442
304987320 276035388
282597216 301611036
262127568 319832544
201842694 355151490
175939362 364098402
142681890 371124858
106707576 37351401...

output:

0
1
-124974732 -213315708 40526725760856504
0
0
0
0
0
0
0
0
1
215091072 -823663680 80880136942550400
0
0
0
0
0
0
0
0
1
825439044 -483597876 -28279162166698872
0
0
0
0
0
0
0
0
1
485373240 126750096 -68632573348392768
0
0
0
0
4
-124974732 -213315708 40526725760856504
215091072 -823663680 8088013694255...

result:

ok 1 test cases (1 test case)

Test #20:

score: 0
Accepted
time: 2ms
memory: 5620kb

input:

1
180
-182099331 -116688857
-171283846 -131987752
-169345591 -134429887
-168418543 -135570401
-163947366 -140838112
-156902016 -148436612
-150919291 -154302887
-148630336 -156419852
-140786662 -163191184
-134190951 -168358657
-128590726 -172405592
-127381416 -173240912
-118682446 -178871372
-1127230...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
-332171398 182071734 -3370458327906410
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
-725990304 -211905408 -13937892662110560
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #21:

score: 0
Accepted
time: 1ms
memory: 5912kb

input:

1
4860
437827436 349656580
437455154 349924606
437194654 350111706
436912664 350313826
436278394 350766876
436118314 350880876
435714164 351168076
435359992 351419040
435169262 351553912
434491420 352031668
434259304 352194706
433883638 352457968
433336234 352840246
432767834 353235516
432655294 353...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #22:

score: 0
Accepted
time: 2ms
memory: 5568kb

input:

1
20
193942440 -131795120
193480280 -129266440
149924960 -19635280
66155040 66967080
-44479640 114688520
-162429680 116649440
-164958360 116187280
-274589520 72631960
-361191880 -11137960
-408913320 -121772640
-410874240 -239722680
-410412080 -242251360
-366856760 -351882520
-283086840 -438484880
-1...

output:

0
0
0
0
1
717801600 -495964800 -14272879121280000
0
0
0
0
1
1208709040 220912480 172140173142808000
0
0
0
0
1
491831760 711819920 185573859834272000
0
0
4
924320 -5057360 -839192429816000
717801600 -495964800 -14272879121280000
1208709040 220912480 172140173142808000
491831760 711819920 185573859834...

result:

ok 1 test cases (1 test case)

Test #23:

score: 0
Accepted
time: 2ms
memory: 5628kb

input:

1
20
72470855 -54298240
137429725 -55993140
150456700 -52396865
195543975 -26919760
205346000 -17616235
237410380 38902815
239105280 103861685
235509005 116888660
210031900 161975935
200728375 171777960
144209325 203842340
79250455 205537240
66223480 201940965
21136205 176463860
11334180 167160335
-...

output:

0
0
0
1
-329879050 -186402110 49676793855140000
0
0
0
0
1
-143476940 -516281160 54147705302102600
0
0
0
0
1
186402110 -329879050 4470911446962600
0
0
0
4
-329879050 -186402110 49676793855140000
-143476940 -516281160 54147705302102600
186402110 -329879050 4470911446962600
-258140580 71738470 22602941...

result:

ok 1 test cases (1 test case)

Test #24:

score: 0
Accepted
time: 2ms
memory: 5600kb

input:

1
4
-118073592 -171275210
26600809 -144674401
0 0
-144674401 -26600809

output:

1
-236147184 -342550420 -43276570688326564
4
-289348802 -53201618 -21638285344163282
-236147184 -342550420 -43276570688326564
53201618 -289348802 -21638285344163282
-171275210 118073592 0

result:

ok 1 test cases (1 test case)

Test #25:

score: 0
Accepted
time: 2ms
memory: 5620kb

input:

1
16
428193876 -34164917
420327800 25320049
378786203 110614460
277759640 188042795
184599153 205986164
125114187 198120088
39819776 156578491
-37608559 55551928
-55551928 -37608559
-47685852 -97093525
-6144255 -182387936
94882308 -259816271
188042795 -277759640
247527761 -269893564
332822172 -22835...

output:

0
0
0
1
606159378 -464570010 -129612107939721552
0
0
0
1
951759456 125857216 -172816143919628736
0
0
0
1
361332230 471457294 -50404708643225048
0
4
15732152 -118969932 -7200672663317864
606159378 -464570010 -129612107939721552
951759456 125857216 -172816143919628736
361332230 471457294 -504047086432...

result:

ok 1 test cases (1 test case)

Test #26:

score: 0
Accepted
time: 2ms
memory: 5720kb

input:

1
48
155042489 -265593648
172926445 -228574850
178675640 -213894605
199126936 -127085877
201057905 -70274010
197876050 -35164325
185763145 20374800
150038945 102092560
141744266 115500063
117496600 148700635
93885305 174879270
40277149 219578232
10280288 238098559
-26738510 255982515
-41418755 26173...

output:

0
0
0
0
0
0
0
1
75091778 -828588566 -58660829392299800
0
0
0
0
0
0
0
0
0
0
0
1
1118112968 -932292636 108870522346725900
0
0
0
0
0
0
0
0
0
0
0
1
1221817038 110728554 216249667675003500
0
0
0
0
0
0
0
0
0
0
0
1
178795848 214432624 48718315935977800
0
4
75091778 -828588566 -58660829392299800
1118112968 ...

result:

ok 1 test cases (1 test case)

Test #27:

score: 0
Accepted
time: 2ms
memory: 5740kb

input:

1
384
78376810 117547358
76421768 116694958
75498034 116279866
75078277 116088595
70505177 113895227
68010194 112611506
66950570 112047094
63580109 110173331
62773145 109706569
62528338 109563554
61260281 108812105
56190944 105623506
55082336 104885282
53863673 104056123
51307301 102254995
49737805 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
155413026 351220806 -16588539225816030
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

result:

ok 1 test cases (1 test case)

Test #28:

score: 0
Accepted
time: 2ms
memory: 5680kb

input:

1
12
213253183 -33554291
173127685 73572365
125323427 108019361
67947575 121430335
-39179081 81304837
-73626077 33500579
-87037051 -23875273
-46911553 -131001929
892705 -165448925
58268557 -178859899
165395213 -138734401
199842209 -90930143

output:

0
0
1
504864528 -229718256 -38457333596543040
0
0
1
520329472 194895276 -27240611297551320
0
0
1
95715940 210360220 0
4
80250996 -214253312 -11216722298991720
504864528 -229718256 -38457333596543040
520329472 194895276 -27240611297551320
95715940 210360220 0

result:

ok 1 test cases (1 test case)

Test #29:

score: 0
Accepted
time: 2ms
memory: 5680kb

input:

1
12
258442634 -423935118
320839514 -209651146
273572726 -29849646
147254266 106555542
-67029706 168952422
-246831206 121685634
-383236394 -4632826
-445633274 -218916798
-398366486 -398718298
-272048026 -535123486
-57764054 -597520366
122037446 -550253578

output:

0
0
1
650944680 -1185775080 -213475676956419360
0
0
1
1408151816 -410036640 0
0
0
1
632413376 347170496 113853694376756992
4
-124793760 -428567944 -99621982579662368
650944680 -1185775080 -213475676956419360
1408151816 -410036640 0
632413376 347170496 113853694376756992

result:

ok 1 test cases (1 test case)

Test #30:

score: 0
Accepted
time: 2ms
memory: 5624kb

input:

1
40
-143405052 371765544
-180012852 329728344
-198578360 301053100
-221951432 250447204
-236501352 194128844
-240565272 138534404
-238212532 104454904
-226547452 49946344
-204396372 -3838296
-188285688 -31173204
-151960952 -76604156
-109923752 -113211956
-81248508 -131777464
-30642612 -155150536
25...

output:

0
1
157092760 242636680 -46788388486470400
0
0
0
1
166284800 643638400 -104956243358080000
0
0
0
0
0
0
0
0
0
1
-626526600 1063024200 -104403842077248000
0
0
0
0
0
0
0
0
0
1
-1045912400 270212800 41291995742192000
0
0
0
0
0
0
0
0
0
1
-253101000 -149173000 40739594461360000
0
4
166284800 643638400 -10...

result:

ok 1 test cases (1 test case)

Test #31:

score: 0
Accepted
time: 35ms
memory: 12320kb

input:

1
44722
-1000000000 -1000000000
-999999999 -999999999
-999999998 -999999996
-999999997 -999999991
-999999996 -999999984
-999999995 -999999975
-999999994 -999999964
-999999993 -999999951
-999999992 -999999936
-999999991 -999999919
-999999990 -999999900
-999999989 -999999879
-999999988 -999999856
-999...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #32:

score: 0
Accepted
time: 13ms
memory: 10396kb

input:

1
30000
-999999999 -999999999
-999999997 -999999991
-999999995 -999999975
-999999993 -999999951
-999999990 -999999900
-999999989 -999999879
-999999987 -999999831
-999999984 -999999744
-999999983 -999999711
-999999982 -999999676
-999999980 -999999600
-999999979 -999999559
-999999977 -999999471
-99999...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #33:

score: 0
Accepted
time: 9ms
memory: 9088kb

input:

1
23333
-1000000000 -1000000000
-999999996 -999999984
-999999994 -999999964
-999999993 -999999951
-999999992 -999999936
-999999991 -999999919
-999999986 -999999804
-999999985 -999999775
-999999983 -999999711
-999999979 -999999559
-999999977 -999999471
-999999976 -999999424
-999999975 -999999375
-999...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1 test cases (1 test case)

Test #34:

score: 0
Accepted
time: 2ms
memory: 5616kb

input:

1
10
-999998304 -997123584
-999995033 -975328911
-999991449 -926880399
-999989625 -892359375
-999986588 -820118256
-999985688 -795166656
-999983492 -727485936
-999982787 -703712631
-999975967 -422414911
-999964606 252735236

output:

0
0
0
0
0
0
0
0

result:

ok 1 test cases (1 test case)

Test #35:

score: 0
Accepted
time: 0ms
memory: 5600kb

input:

5
4
0 -1000000000
1 -1
2 999999999
1 0
4
1000000000 1000000000
-1000000000 1000000000
-1000000000 -1000000000
999999999 -999999999
3
0 -1
1 0
0 1
4
0 0
0 1
-1 2
-1 1
4
0 0
0 1
-1 2
-1 -1

output:

0
0
1
4000000000 4000000000 0
1
4000000000 4000000000 0
1
0 -4 0
0
0
0
1
0 -2 1

result:

ok 5 test cases (5 test cases)