QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#449936#8294. Axis of SymmetryPetroTarnavskyi#AC ✓576ms4776kbC++203.0kb2024-06-21 19:46:412024-06-21 19:46:42

Judging History

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

  • [2024-06-21 19:46:42]
  • 评测
  • 测评结果:AC
  • 用时:576ms
  • 内存:4776kb
  • [2024-06-21 19:46:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;

const int mod1 = 1e9 + 7;
const int mod2 = 1e9 + 9;
const LL mod = (LL)mod1 * mod2;
const int C = 2e8 + 47;
const int INF = 1e9;
const LL p = 892388953;
const LL q = 347723788;

LL add(LL a, LL b)
{
	return a + b < mod ? a + b : a + b - mod;
}

LL sub(LL a, LL b)
{
	return a - b >= 0 ? a - b : a - b + mod;
}

LL mult(LL a, LL b)
{
	return (__int128)a * b % mod;
}

LL binpow(LL a, int n)
{
	assert(n > 0);
	LL res = 1;
	while (n)
	{
		if (n & 1)
			res = mult(res, a);
		a = mult(a, a);
		n >>= 1;
	}
	return res;
}

LL getRectHash(int x1, int y1, int x2, int y2)
{
	if (x1 > x2)
		swap(x1, x2);
	if (y1 > y2)
		swap(y1, y2);
	return mult(sub(binpow(p, x2 + C), binpow(p, x1 + C)), sub(binpow(q, y2 + C), binpow(q, y1 + C)));
}

pair<bool, PII> reflect(LL a, LL b, LL c, LL x, LL y)
{
	LL num1 = 2 * a * (a * x + b * y + c), num2 = 2 * b * (a * x + b * y + c);
	LL den = a * a + b * b;
	if (num1 % den != 0 || num2 % den != 0)
	{
		return {false, {0, 0}};
	}
	return {true, {x - num1 / den, y - num2 / den}};
}

void solve()
{
	int n;
	cin >> n;
	VI x1(n), y1(n), x2(n), y2(n);
	FOR(i, 0, n)
	{
		cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
	}
	LL h0 = 0;
	FOR(i, 0, n)
	{
		h0 = add(h0, getRectHash(x1[i], y1[i], x2[i], y2[i]));
	}
	auto check = [&](int a, int b, int c) -> bool
	{
		LL h = 0;
		FOR(i, 0, n)
		{
			auto [can1, p1] = reflect(a, b, c, x1[i], y1[i]);
			auto [can2, p2] = reflect(a, b, c, x2[i], y2[i]);
			if (!can1 || !can2)
				return false;
			h = add(h, getRectHash(p1.F, p1.S, p2.F, p2.S));
		}
		return h == h0;
	};
	vector<tuple<int, int, int>> ans;
	auto f = [&](int a, int b) -> void
	{
		int mn = INF, mx = -INF;
		FOR(i, 0, n)
		{
			mn = min(mn, a * x1[i] + b * y1[i]);
			mn = min(mn, a * x1[i] + b * y2[i]);
			mn = min(mn, a * x2[i] + b * y1[i]);
			mn = min(mn, a * x2[i] + b * y2[i]);
			
			mx = max(mx, a * x1[i] + b * y1[i]);
			mx = max(mx, a * x1[i] + b * y2[i]);
			mx = max(mx, a * x2[i] + b * y1[i]);
			mx = max(mx, a * x2[i] + b * y2[i]);
		}
		int c = -(mn + mx) / 2;
		if (check(a, b, c))
		{
			ans.PB({a, b, c});
		}
	};
	f(0, 2);
	f(2, 0);
	f(2, 2);
	f(2, -2);
	for (auto& [a, b, c] : ans)
	{
		int g = gcd(gcd(abs(a), abs(b)), abs(c));
		a /= g;
		b /= g;
		c /= g;
	}
	sort(ALL(ans), greater());
	cout << SZ(ans) << "\n";
	FOR(i, 0, SZ(ans))
	{
		auto [a, b, c] = ans[i];
		if (i > 0)
			cout << " ";
		cout << a << " " << b << " " << -c;
	}
	cout << "\n";
}

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

input:

3
2
-1 -1 0 1
0 0 1 2
2
-1 -1 0 0
0 0 1 1
3
-1 -1 0 1
0 -1 1 0
0 0 1 1

output:

0

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

result:

ok 6 lines

Test #2:

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

input:

1
1
0 0 1 1

output:

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

result:

ok 2 lines

Test #3:

score: 0
Accepted
time: 466ms
memory: 3508kb

input:

100000
1
526784 -41279256 80737916 -28909193
1
23027906 -27293889 32341105 73135511
1
66254378 53048112 79955390 80319226
1
-28248645 -64220207 31172070 23946352
1
-97782470 -83732101 25817829 -36395794
1
-91301122 -8301641 -32995672 1173698
1
-93877343 2829077 -13170916 5694902
1
-17180254 -1878131...

output:

2
1 0 40632350 0 2 -70188449
2
2 0 55369011 0 1 22920811
2
1 0 73104884 0 1 66683669
2
2 0 2923425 0 2 -40273855
2
2 0 -71964641 0 2 -120127895
2
1 0 -62148397 0 2 -7127943
2
2 0 -107048259 0 2 8523979
2
2 0 27311401 0 2 79688327
2
2 0 9387131 0 1 -77343188
2
2 0 -55677363 0 1 -62581209
2
1 0 -29144...

result:

ok 200000 lines

Test #4:

score: 0
Accepted
time: 314ms
memory: 4632kb

input:

3
95057
78566414 -29010341 80737916 -28909193
75901695 -29361779 76943589 -28909193
78067247 -29150770 78067268 -28909193
76938806 -34231847 76943589 -34196284
76783576 -33527632 76943589 -33527585
77480784 -28935613 77482750 -28909193
79606957 -36783646 80737916 -36783617
78017221 -29775439 7806726...

output:

2
1 0 40632350 0 2 -70188449
2
1 0 -86452115 0 2 -107850609
2
2 0 -75272587 0 2 -98866193

result:

ok 6 lines

Test #5:

score: 0
Accepted
time: 576ms
memory: 3856kb

input:

100000
1
80737916 -41279256 81264700 -40752472
1
23027906 32341105 51937099 61250298
1
-28248645 23946352 2923425 55118422
1
-97782470 25817829 -33562263 90038036
1
-36395794 -32995672 47336307 50736429
1
1173698 -8301641 92474820 82999481
1
-93877343 2829077 -80706427 15999993
1
-17180254 44491655 ...

output:

4
1 1 39985444 1 0 81001308 1 -1 122017172 0 1 -41015864
4
2 0 74965005 1 1 84278204 1 -1 -9313199 0 2 93591403
4
1 1 26869777 1 0 -12662610 1 -1 -52194997 0 1 39532387
4
2 0 -131344733 1 1 -7744434 1 -1 -123600299 0 2 115855865
4
2 0 10940513 1 1 14340635 1 -1 -3400122 0 2 17740757
4
1 1 84173179 1...

result:

ok 200000 lines

Test #6:

score: 0
Accepted
time: 497ms
memory: 4532kb

input:

4
87800
81264415 -40754187 81264700 -40752472
80988007 -40945584 81264700 -40945512
81264364 -40848803 81264700 -40831609
80841251 -40833367 80844169 -40831609
80843825 -40912201 80844169 -40909877
80844048 -40927601 80844169 -40927567
80843796 -40847358 80844169 -40847345
81200233 -40752595 8123153...

output:

4
1 1 39985444 1 0 81001308 1 -1 122017172 0 1 -41015864
4
1 1 -19816370 1 0 -4196768 1 -1 11422834 0 1 -15619602
4
2 0 2693945 1 1 -21575457 1 -1 24269402 0 2 -45844859
4
1 1 -63604156 1 0 -44360092 1 -1 -25116028 0 1 -19244064

result:

ok 8 lines

Test #7:

score: 0
Accepted
time: 433ms
memory: 3628kb

input:

50000
2
66254378 53048112 79955390 80319226
-34113768 53048112 -20412756 80319226
2
-64883027 -37362666 -60279391 -20926414
4602028 -37362666 9205664 -20926414
2
-2551504 64014030 9681686 67742279
-50387731 64014030 -38154541 67742279
2
-32662281 -84079032 -11806456 39603034
-8048079 -84079032 12807...

output:

2
1 0 22920811 0 1 66683669
2
2 0 -55677363 0 1 -29144540
2
2 0 -40706045 0 2 131756309
2
2 0 -19854535 0 1 -22237999
2
2 0 -68586581 0 1 -15678451
2
1 0 -6187259 0 1 54175415
2
2 0 129900345 0 1 8843233
2
2 0 -47120491 0 2 38437237
2
1 0 29750926 0 2 -35489795
2
1 0 -11509006 0 1 -47395407
2
2 0 34...

result:

ok 100000 lines

Test #8:

score: 0
Accepted
time: 515ms
memory: 4708kb

input:

3
97071
79871361 79904900 79955390 80319226
-29216806 79897851 -20412756 80319226
77721306 78937767 77764682 80319226
79953708 56088943 79955390 56092351
79953912 72138980 79955390 72166866
79955313 73907777 79955390 77617469
68128488 80317953 68260073 80319226
66411395 79741456 66432299 80319226
68...

output:

2
1 0 22920811 0 1 66683669
2
1 0 -1112347 0 1 -32684854
2
1 0 -49319564 0 1 -16681065

result:

ok 6 lines

Test #9:

score: 0
Accepted
time: 423ms
memory: 3600kb

input:

50000
2
66254378 53048112 79955390 80319226
66254378 11364018 79955390 38635132
2
-64883027 -37362666 -60279391 -20926414
-64883027 -90428312 -60279391 -73992060
2
-38599294 -14722902 44342364 -8929101
-38599294 -91782531 44342364 -85988730
2
-57698619 22814848 90675556 60951109
-57698619 -43471407 ...

output:

2
1 0 73104884 0 1 45841622
2
1 0 -62581209 0 1 -55677363
2
1 0 2871535 0 1 -50355816
2
2 0 32976937 0 1 8739851
2
2 0 -73524103 0 1 -60973388
2
1 0 -1742694 0 1 6816654
2
1 0 86601099 0 1 -43003943
2
2 0 -113601881 0 1 -23018012
2
1 0 13454832 0 1 -23438872
2
2 0 91909749 0 1 34969443
2
1 0 4201251...

result:

ok 100000 lines

Test #10:

score: 0
Accepted
time: 509ms
memory: 4640kb

input:

3
97071
79871361 79904900 79955390 80319226
71151340 38213757 79955390 38635132
77721306 78937767 77764682 80319226
79953708 56088943 79955390 56092351
79953912 72138980 79955390 72166866
79955313 73907777 79955390 77617469
68128488 80317953 68260073 80319226
66411395 79741456 66432299 80319226
6823...

output:

2
1 0 73104884 0 1 45841622
2
2 0 -21646109 0 1 -48579306
2
2 0 -30746821 0 1 5787103

result:

ok 6 lines

Test #11:

score: 0
Accepted
time: 487ms
memory: 3864kb

input:

50000
2
66254378 53048112 79955390 80319226
-34477604 -34113768 -7206490 -20412756
2
-64883027 -37362666 -60279391 -20926414
-34750949 4602028 -18314697 9205664
2
11816206 44047620 69124540 77653211
-23206429 -14677758 10399162 42630576
2
-46303478 -47473856 -27220625 -43223088
-17750300 -33752763 -...

output:

1
1 1 45841622
1
1 1 -55677363
1
1 1 54446782
1
1 1 -60973388
1
1 1 6816654
1
1 1 -23018012
1
1 1 34969443
1
1 1 -26971911
1
1 1 -453970
1
1 1 13848097
1
1 1 3470648
1
1 1 4589302
1
1 1 6211008
1
1 1 -5832500
1
1 1 -104339197
1
1 1 -27332143
1
1 1 124660202
1
1 1 15542695
1
1 1 23546841
1
1 1 -68603...

result:

ok 100000 lines

Test #12:

score: 0
Accepted
time: 512ms
memory: 4632kb

input:

3
96992
79755133 79546518 79955390 80319226
-7330514 -21155645 -7206490 -20412756
77528753 78937767 77764682 80319226
79953708 56086813 79955390 56092351
79939949 66337586 79955390 72166866
79955027 73767941 79955390 77617469
68260019 80274140 68260073 80319226
66431525 76664662 66432299 80319226
68...

output:

1
1 1 45841622
1
1 1 -39525836
1
1 1 32279841

result:

ok 6 lines

Test #13:

score: 0
Accepted
time: 481ms
memory: 3568kb

input:

50000
2
-41279256 23027906 -28909193 32341105
-57183226 38931876 -47870027 51301939
2
-2551504 64014030 9681686 67742279
-9712471 71174997 -5984222 83408187
2
47548734 -42942302 84144226 26180397
-53936144 58542576 15186555 95138068
2
-48464523 -68196196 -35677514 -20545745
-31967604 -84693115 15682...

output:

1
1 -1 -80211132
1
1 -1 -73726501
1
1 -1 -10993842
1
1 -1 36228592
1
1 -1 -33800712
1
1 -1 -24370712
1
1 -1 -25320535
1
1 -1 1249047
1
1 -1 96248003
1
1 -1 -10205996
1
1 -1 -21308378
1
1 -1 -49993092
1
1 -1 -3719024
1
1 -1 32920149
1
1 -1 51355521
1
1 -1 -12772494
1
1 -1 3828808
1
1 -1 -5859609
1
1 ...

result:

ok 100000 lines

Test #14:

score: 0
Accepted
time: 512ms
memory: 4628kb

input:

3
95591
-29025273 28500222 -28909193 32341105
-53958662 49452081 -47870027 51301939
-35076067 32219139 -35075039 32341105
-47886426 46010719 -47870027 46014848
-49755376 46482857 -47870027 46683547
-39070576 31967435 -38305515 32341105
-28966942 25747852 -28909193 26207667
-35538979 27166800 -350750...

output:

1
1 -1 -80211132
1
1 -1 7449347
1
1 -1 -38218095

result:

ok 6 lines

Test #15:

score: 0
Accepted
time: 521ms
memory: 3664kb

input:

50000
2
-13170916 -93877343 -4869275 -85575702
-4551722 -85258149 3749919 -76956508
2
-49999859 59386990 -31218549 78168300
-69644321 39742528 -50863011 58523838
2
-84345321 -25234593 -78250339 -19139611
-25336387 33774341 -19241405 39869323
2
72227256 65017327 86675458 79465529
-81269627 -88479556 ...

output:

2
1 1 -90127424 1 -1 80706427
2
1 1 8523979 1 -1 -109386849
2
1 1 -44475998 1 -1 -59110728
2
1 1 -1804098 1 -1 7209929
2
1 1 -49904459 1 -1 12383905
2
1 1 -30152925 1 -1 -48170034
2
1 1 47423276 1 -1 54094902
2
1 1 85659365 1 -1 -1225912
2
1 1 -80638036 1 -1 19082853
2
1 1 6816654 1 -1 89707433
2
1 ...

result:

ok 100000 lines

Test #16:

score: 0
Accepted
time: 503ms
memory: 4624kb

input:

3
94713
-5398946 -87370868 -4869275 -85575702
3746761 -78024570 3749919 -76956508
-1856910 -77892624 -1849457 -76956508
-1836683 -76971699 -1582259 -76956508
-1582352 -81381958 -1582259 -80251231
-1767653 -77663471 -1582259 -77659370
-1582273 -82973185 -1582259 -82910450
-1818438 -82910639 -1783649 ...

output:

2
1 1 -90127424 1 -1 80706427
2
1 1 -6419875 1 -1 91894319
2
1 1 67985688 1 -1 5444804

result:

ok 6 lines

Test #17:

score: 0
Accepted
time: 519ms
memory: 3824kb

input:

50000
2
-49999859 59386990 -31218549 78168300
56521165 -47134034 75302475 -28352724
2
-53102995 -60279391 -50528627 -57705023
-99186779 -14195607 -96612411 -11621239
2
-16505819 -62071790 48268163 2702192
-88208869 9631260 -23434887 74405242
2
-56406167 -5436494 -46766688 4202985
-91697340 29854679 ...

output:

2
1 1 28168441 1 -1 -2865825
2
1 1 -110808018 1 -1 -38907388
2
1 1 -13803627 1 -1 -26137079
2
1 1 -52203182 1 -1 -86260846
2
1 1 99310396 1 -1 -11477282
2
1 1 48809917 1 -1 4250768
2
1 1 29105227 1 -1 -34921255
2
1 1 -48429538 1 -1 1010526
2
1 1 66129036 1 -1 -52612845
2
1 1 1459188 1 -1 -21308378
2...

result:

ok 100000 lines

Test #18:

score: 0
Accepted
time: 506ms
memory: 4776kb

input:

3
96039
-31220415 77753692 -31218549 78168300
67382953 -28767248 75302475 -28352724
-31218565 61125414 -31218549 61705711
-37856816 61705335 -37831040 61705711
56521165 -28374033 67382953 -28352724
-31351874 61675193 -31348178 61705711
-37833271 61362440 -37831040 61371221
-37831082 59898997 -378310...

output:

2
1 1 28168441 1 -1 -2865825
2
1 1 -91280596 1 -1 -25836948
2
1 1 49647065 1 -1 33470882

result:

ok 6 lines

Test #19:

score: 0
Accepted
time: 424ms
memory: 4716kb

input:

1
100000
-89539071 -26479231 -89539070 -26479230
-45592861 -44485968 -45592860 -44485967
-20063918 -674504 -20063917 -674503
36848666 -9501021 36848667 -9501020
11385818 87406324 11385819 87406325
-66940185 24650257 -66940184 24650258
-8020977 43420771 -8020976 43420772
37863716 14878699 37863717 14...

output:

0


result:

ok single line: '0'

Test #20:

score: 0
Accepted
time: 311ms
memory: 4612kb

input:

1
100000
10460936 -26479231 10460937 -26479230
-10460937 -26479231 -10460936 -26479230
54407146 -44485968 54407147 -44485967
-54407147 -44485968 -54407146 -44485967
79936089 -674504 79936090 -674503
-79936090 -674504 -79936089 -674503
36848666 -9501021 36848667 -9501020
-36848667 -9501021 -36848666 ...

output:

1
1 0 0

result:

ok 2 lines

Test #21:

score: 0
Accepted
time: 509ms
memory: 4652kb

input:

1
100000
-89539071 73520776 -89539070 73520777
-89539071 -73520777 -89539070 -73520776
-45592861 55514039 -45592860 55514040
-45592861 -55514040 -45592860 -55514039
-20063918 99325503 -20063917 99325504
-20063918 -99325504 -20063917 -99325503
36848666 90498986 36848667 90498987
36848666 -90498987 36...

output:

1
0 1 0

result:

ok 2 lines

Test #22:

score: 0
Accepted
time: 521ms
memory: 4612kb

input:

1
100000
10460936 73520776 10460937 73520777
-73520777 -10460937 -73520776 -10460936
54407146 55514039 54407147 55514040
-55514040 -54407147 -55514039 -54407146
79936089 99325503 79936090 99325504
-99325504 -79936090 -99325503 -79936089
36848666 90498986 36848667 90498987
-90498987 -36848667 -904989...

output:

1
1 1 0

result:

ok 2 lines

Test #23:

score: 0
Accepted
time: 433ms
memory: 4632kb

input:

1
100000
10460936 -26479231 10460937 -26479230
-26479231 10460936 -26479230 10460937
54407146 -44485968 54407147 -44485967
-44485968 54407146 -44485967 54407147
79936089 -674504 79936090 -674503
-674504 79936089 -674503 79936090
36848666 -9501021 36848667 -9501020
-9501021 36848666 -9501020 36848667...

output:

1
1 -1 0

result:

ok 2 lines

Test #24:

score: 0
Accepted
time: 480ms
memory: 3968kb

input:

17
37007
-1 99764660 0 100000007
0 99999835 1 100000007
0 -60062507 1 -60062488
0 -62587150 1 -62587139
0 -90594618 1 -90594612
0 -74744494 1 -74744429
0 -66213811 1 -66143823
0 -60182523 1 -60182272
0 -63342738 1 -63341896
0 75451132 1 77550546
0 -63271887 1 -63271878
0 -61261086 1 -61057676
0 -632...

output:

2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
2 0 -36737315 0 2 32607691

result:

ok 34 lines

Test #25:

score: 0
Accepted
time: 487ms
memory: 3840kb

input:

16
42595
100000006 -1 100000007 0
100000006 0 100000007 1
66303504 0 66303748 1
-33895692 -1 -33689958 0
94666244 0 94666775 1
-7212291 0 -6915682 1
-62268926 0 -62267871 1
-68565775 -1 -67650840 0
-59471296 -1 -59465941 0
99542180 0 99547979 1
-68821427 0 -68819877 1
98555172 0 98556746 1
99692379 ...

output:

2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0

result:

ok 32 lines

Test #26:

score: 0
Accepted
time: 420ms
memory: 4608kb

input:

3
96467
-11396451 42852671 -10555381 48832465
-40770775 48764113 -40757749 48832465
-40783453 40987431 -40757749 41012154
-61919846 21557273 -61919845 41012154
-59413564 47807972 -59384919 48832465
-59760870 43786572 -59384919 43908190
-64537982 40385893 -64537924 41012154
-40808261 13770593 -407577...

output:

0

0

2
1 0 -21573246 0 1 -44632133

result:

ok 6 lines

Test #27:

score: 0
Accepted
time: 324ms
memory: 4636kb

input:

3
93692
-60562304 23478268 -60042068 23479426
-67739801 23238167 -67736864 23479426
-60058622 22419950 -60042068 23065844
-62815227 23466044 -62071172 23479426
-62071220 23095299 -62071172 23149739
-60047903 23152903 -60042068 23161786
-64678543 23149187 -64235286 23149739
-60138370 23159747 -601304...

output:

0

0

4
1 1 51163563 1 0 72353568 1 -1 93543573 0 1 -21190005

result:

ok 6 lines

Test #28:

score: 0
Accepted
time: 321ms
memory: 4716kb

input:

3
95820
23000046 74460334 23001299 74759310
-25396968 23442100 -25171540 74759310
-27221017 74755557 -26518136 74759310
-26534865 56030058 -26518136 56048832
-27288761 74605609 -27287664 74759310
22676600 11519900 23001299 11559458
-28459396 74674839 -28459048 74759310
-26518225 21119069 -26518136 2...

output:

0

0

2
2 0 -24260641 0 1 -70431343

result:

ok 6 lines

Test #29:

score: 0
Accepted
time: 506ms
memory: 4636kb

input:

3
96665
-9805794 86672313 -9804756 88250586
-27176615 19215962 -9804756 19457921
-79919981 86594432 -79918343 88250586
-9811230 7829400 -9804756 8602827
-12264672 88250085 -10295524 88250586
-10013122 87950561 -9939703 88250586
-79926294 81244634 -79918343 81496033
-20623551 8588933 -17940806 860282...

output:

0

0

2
1 0 -5295379 0 1 -16369673

result:

ok 6 lines

Test #30:

score: 0
Accepted
time: 415ms
memory: 4612kb

input:

3
96064
-18484147 6588559 -18390872 9731876
58947189 56682240 59023397 56682742
13600746 55389471 13804473 56682742
-32450953 -60611473 -18390872 -60602314
58799117 31450761 59023397 31490236
-36785081 -60754819 -18390872 -60754344
-19563970 -60885573 -18390872 -60884232
7846401 43742457 13804473 44...

output:

0

0

1
1 1 23300844

result:

ok 6 lines

Test #31:

score: 0
Accepted
time: 416ms
memory: 4712kb

input:

3
96716
92302400 -8027113 92518494 -7831549
58094403 25493838 58577474 26109471
89602591 -32988352 92518494 -32964338
91337829 -7889058 91379483 -7831549
92484225 -42084648 92518494 -41636749
80610400 -72530422 80610403 -41636749
55305533 23985806 58577474 24679137
87166343 -41636935 89864890 -41636...

output:

0

1
1 -1 -18150455
1
1 -1 -6915747

result:

ok 6 lines

Test #32:

score: 0
Accepted
time: 512ms
memory: 4656kb

input:

3
95765
18968139 58247151 19629522 58278361
-17416528 21245866 -17378271 21270568
-21367746 20485681 -21132698 21270568
17317446 57576993 19629522 57856937
-18806817 6975598 -17378271 6975972
2076663 58273561 2392011 58278361
-1990528 42330115 19629522 42371989
2387695 58009076 2392011 58067679
-176...

output:

2
1 1 19280040 1 -1 -38648839
0

2
1 1 -80601593 1 -1 -514276

result:

ok 6 lines

Test #33:

score: 0
Accepted
time: 417ms
memory: 4656kb

input:

3
93701
20835853 -47293793 21295051 -46990719
-18711371 -9987852 -16147238 -9548430
-16164011 -20643535 -16147238 -20643470
-20701240 -20643871 -19851237 -20643470
21279881 -51248095 21295051 -51248056
13812633 -51754741 13843544 -51248056
21286980 -50492231 21295051 -50486856
20811778 -51546469 208...

output:

0

0

2
1 1 -4645660 1 -1 -18999292

result:

ok 6 lines

Test #34:

score: 0
Accepted
time: 521ms
memory: 4628kb

input:

1
100000
95247541 41039487 95247542 41039488
-7920431 -7303866 -7920430 -7303865
84314801 43165207 84314802 43165208
51340319 85532479 51340320 85532480
-25832355 95491494 -25832354 95491495
43899929 18607031 43899930 18607032
51676307 -87124734 51676308 -87124733
-61767287 54127060 -61767286 541270...

output:

0


result:

ok single line: '0'

Test #35:

score: 0
Accepted
time: 502ms
memory: 4636kb

input:

1
100000
95247541 41039487 95247542 41039488
-95247542 41039487 -95247541 41039488
92079576 -7303866 92079577 -7303865
-92079577 -7303866 -92079576 -7303865
84314801 43165207 84314802 43165208
-84314802 43165207 -84314801 43165208
51340319 85532479 51340320 85532480
-51340320 85532479 -51340319 8553...

output:

1
1 0 0

result:

ok 2 lines

Test #36:

score: 0
Accepted
time: 312ms
memory: 4672kb

input:

1
100000
95247541 41039487 95247542 41039488
95247541 -41039488 95247542 -41039487
-7920431 92696141 -7920430 92696142
-7920431 -92696142 -7920430 -92696141
84314801 43165207 84314802 43165208
84314801 -43165208 84314802 -43165207
51340319 85532479 51340320 85532480
51340319 -85532480 51340320 -8553...

output:

1
0 1 0

result:

ok 2 lines

Test #37:

score: 0
Accepted
time: 420ms
memory: 4708kb

input:

1
100000
95247541 41039487 95247542 41039488
-41039488 -95247542 -41039487 -95247541
92079576 92696141 92079577 92696142
-92696142 -92079577 -92696141 -92079576
84314801 43165207 84314802 43165208
-43165208 -84314802 -43165207 -84314801
51340319 85532479 51340320 85532480
-85532480 -51340320 -855324...

output:

1
1 1 0

result:

ok 2 lines

Test #38:

score: 0
Accepted
time: 523ms
memory: 4760kb

input:

1
100000
95247541 -58960520 95247542 -58960519
-58960520 95247541 -58960519 95247542
92079576 -7303866 92079577 -7303865
-7303866 92079576 -7303865 92079577
84314801 -56834800 84314802 -56834799
-56834800 84314801 -56834799 84314802
51340319 -14467528 51340320 -14467527
-14467528 51340319 -14467527 ...

output:

1
1 -1 0

result:

ok 2 lines

Test #39:

score: 0
Accepted
time: 483ms
memory: 3844kb

input:

17
40473
-1 99999946 0 100000007
0 99999942 1 100000007
0 -47328210 1 -47323401
0 -55004976 1 -55004969
-1 94363993 0 94374222
0 91325145 1 91325235
-1 -27095953 0 -27095936
0 -50719728 1 -49922989
0 -32338620 1 -32335824
0 -84458690 1 -83297266
0 -49533313 1 -49533312
0 -22799909 1 -22799902
0 -498...

output:

2
1 0 0 0 1 0
2
1 0 0 0 1 0
0

2
1 0 0 0 1 0
0

0

0

2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
0

2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0

result:

ok 34 lines

Test #40:

score: 0
Accepted
time: 485ms
memory: 3840kb

input:

16
40345
99997543 -1 100000007 0
99984864 0 100000007 1
-85827714 -1 -85827526 0
98241148 -1 98249991 0
44381416 0 45045772 1
-11108974 -1 -10988681 0
63234051 0 63243703 1
-51186600 0 -51180642 1
77220942 0 77332949 1
99084802 -1 99084803 0
99407195 -1 99407202 0
-72285211 0 -72274127 1
99363830 -1...

output:

2
1 0 0 0 1 0
0

2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
0

2
1 0 0 0 1 0
2
1 0 0 0 1 0
0

0

2
1 0 0 0 1 0
0

2
1 0 0 0 1 0
2
1 0 0 0 1 0
2
1 0 0 0 1 0
0


result:

ok 31 lines

Extra Test:

score: 0
Extra Test Passed