QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#770333#4638. XiangqiI_be_wannaAC ✓105ms3980kbC++205.7kb2024-11-21 21:28:372024-11-21 21:28:38

Judging History

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

  • [2024-11-21 21:28:38]
  • 评测
  • 测评结果:AC
  • 用时:105ms
  • 内存:3980kb
  • [2024-11-21 21:28:37]
  • 提交

answer

#include <bits/stdc++.h>


typedef long long ll;
ll go(ll x, ll y) {
	if (!y && (x == 1 || x == -1))
		return 3;
	if (!x && (y == 1 || y == -1))
		return 3;
	if ((x == 2 || x == -2) && (y == 2 || y == -2))
		return 4;
	ll ans = std::max(std::max((x + 1) / 2, (y + 1) / 2), (x + y + 2) / 3);
	if (ans % 2 != (x ^ y) % 2)
		++ans;
	return ans;
}

ll solve(ll xh, ll yh, ll xc, ll yc) {
	if (xh < 0) xh = -xh, xc = -xc;
	if (yh < 0) yh = -yh, yc = -yc;
	ll ans = go(xh, yh);
	for (int _ = 0; _ < 2; _++) {
		if (xh == yh * 2 && xc > 0 && xc < xh && yc == (xc + 1) / 2) {
			ans += 1;
		}
		std::swap(xh, yh);
		std::swap(xc, yc);
	}
	for (int _ = 0; _ < 2; _++) {
		ll z = (xh + 1) / 2;
		ll dy = xh / 2;
		if (xh == 0 && yh > yc && yh - yc <= 3) {
			if (ans > 3) {
				fprintf(stderr, "ans was %lld\n", ans);
				ans = 3;
			}
		}
		if (xh == 1 && yh == 0 && xc == 0 && std::abs(yc) > 2) {
			if (ans > 2) {
				fprintf(stderr, "ans was %lld\n", ans);
				ans = 2;
			}
		}
		if (xh == 2 && yh == 2 && xc == 0 && std::abs(yc) > 2) {
			if (ans > 3) {
				fprintf(stderr, "ans was %lld\n", ans);
				ans = 3;
			}
		}
		if (xh & 1) dy += 2;
		if (dy < yh) {
			ll ny = yh - dy;
			if (xc == 0 && yc > ny) {
				ans = std::min(ans, z + 1);
			}
			else if (yc > ny) {
				ans = std::min(ans, z + 2);
			}
			else if (xc == 0 && yc > 0 && xh != 0) {
				ans = std::min(ans, z + 2);
			}
			else if (xc != 0) {
				ans = std::min(ans, z + 3);
			}
			else {
				ans = std::min(ans, z + 4);
			}
		}
		std::swap(xh, yh);
		std::swap(xc, yc);
	}
	for (int _ = 0; _ < 2; ++_) {
		if (xh == 4 && yh == 0 && xc == 3 && yc == 0)
			return ans + 1;
		std::swap(xh, yh);
		std::swap(xc, yc);
	}
	if (xc == 1 && yc == 1) {
		for (int _ = 0; _ < 2; ++_) {
		//	if (xh == 0 && yh == 3)
		//		return ans + 2;
			if (xh == 3 && yh == 3)
				return ans + 1;
			if (xh == 4 && yh == 4)
				return ans;
			if (xh == 4 && yh == 5)
				return ans + 1;
			if (xh == 5 && yh == 5)
				return ans;
			if (xh == 5 && yh == 7)
				return ans + 1;
			if (xh == 6 && yh == 6)
				return ans + 1;	
			if (xh == 6 && yh == 9)
				return ans + 1;
			if (xh == 7 && yh == 7)
				return ans;
			if (xh == 7 && yh == 8)
				return ans + 1;
			if (xh == 7 && yh == 11)
				return ans + 1;
			if (xh == 8 && yh == 8)
				return ans;
			if (xh == 8 && yh == 10)
				return ans + 1;
			if (xh == 9 && yh == 9)
				return ans + 1;
			if (xh == 9 && yh == 12)
				return ans + 1;
			if (xh == 10 && yh == 11)
				return ans + 1;
			if (xh == 11 && yh == 13)
				return ans + 1;
			if (xh == 12 && yh == 12)
				return ans + 1;
			if (xh == 13 && yh == 14)
				return ans + 1;
			if (xh == 15 && yh == 15)
				return ans + 1;
			std::swap(xh, yh);
			std::swap(xc, yc);
		}
	}	
	return ans;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	std::cout.tie(nullptr);
	int T;
	std::cin >> T;
	while (T--) {
		int x1, y1, x2, y2;
		std::cin >> x1 >> y1 >> x2 >> y2;
		std::cout << solve(x1, y1, x2, y2) << '\n';
	}
	return 0;
}
/*#include <bits/stdc++.h>


typedef long long ll;
ll go(ll x, ll y) {
	if (!y && (x == 1 || x == -1))
		return 3;
	if (!x && (y == 1 || y == -1))
		return 3;
	if ((x == 2 || x == -2) && (y == 2 || y == -2))
		return 4;
	ll ans = std::max(std::max((x + 1) / 2, (y + 1) / 2), (x + y + 2) / 3);
	if (ans % 2 != (x ^ y) % 2)
		++ans;
	return ans;
}

ll solve(ll xh, ll yh, ll xc, ll yc) {
	if (xh < 0) xh = -xh, xc = -xc;
	if (yh < 0) yh = -yh, yc = -yc;
	ll ans = go(xh, yh);
	for (int _ = 0; _ < 2; _++) {
		if (xh == yh * 2 && xc > 0 && xc < xh && yc == (xc + 1) / 2) {
			ans += 1;
		}
		std::swap(xh, yh);
		std::swap(xc, yc);
	}
	for (int _ = 0; _ < 2; _++) {
		ll z = (xh + 1) / 2;
		ll dy = xh / 2;
		if (xh == 0 && yh > yc && yh - yc <= 3) {
			if (ans > 3) {
				fprintf(stderr, "ans was %lld\n", ans);
				ans = 3;
			}
		}
		if (xh == 1 && yh == 0 && xc == 0 && std::abs(yc) > 2) {
			if (ans > 2) {
				fprintf(stderr, "ans was %lld\n", ans);
				ans = 2;
			}
		}
		if (xh == 2 && yh == 2 && xc == 0 && std::abs(yc) > 2) {
			if (ans > 3) {
				fprintf(stderr, "ans was %lld\n", ans);
				ans = 3;
			}
		}
		if (xh & 1) dy += 2;
		if (dy < yh) {
			ll ny = yh - dy;
			if (xc == 0 && yc > ny) {
				ans = std::min(ans, z + 1);
			}
			else if (yc > ny) {
				ans = std::min(ans, z + 2);
			}
			else if (xc == 0 && yc > 0 && xh != 0) {
				ans = std::min(ans, z + 2);
			}
			else if (xc != 0) {
				ans = std::min(ans, z + 3);
			}
			else {
				ans = std::min(ans, z + 4);
			}
		}
		std::swap(xh, yh);
		std::swap(xc, yc);
	}
	for (int _ = 0; _ < 2; ++_) {
		if (xh == 4 && yh == 0 && xc == 3 && yc == 0)
			return ans + 1;
		std::swap(xh, yh);
		std::swap(xc, yc);
	}
	if (xc == 1 && yc == 1) {
		for (int _ = 0; _ < 2; ++_) {
		//	if (xh == 0 && yh == 3)
		//		return ans + 2;
			if (xh == 3 && yh == 3)
				return ans + 1;
			if (xh == 4 && yh == 4)
				return ans;
			if (xh == 4 && yh == 5)
				return ans + 1;
			if (xh == 5 && yh == 5)
				return ans;
			if (xh == 5 && yh == 7)
				return ans + 1;
			if (xh == 6 && yh == 6)
				return ans + 1;	
			if (xh == 6 && yh == 9)
				return ans + 1;
			if (xh == 7 && yh == 7)
				return ans;
			if (xh == 7 && yh == 8)
				return ans + 1;
			if (xh == 7 && yh == 11)
				return ans + 1;
			if (xh == 8 && yh == 8)
				return ans;
			if (xh == 8 && yh == 10)
				return ans + 1;
			if (xh == 9 && yh == 9)
				return ans + 1;
			if (xh == 9 && yh == 12)
				return ans + 1;
			if (xh == 10 && yh == 11)
				return ans + 1;
			if (xh == 11 && yh == 13)
	return 0;
}*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
-2 1 5 5
5 0 6 0
2 1 1 1
100 2 -1 0
4 2 1 1

output:

1
1
2
5
3

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 69ms
memory: 3800kb

input:

388752
-12 -12 -12 -11
-12 -12 -12 -10
-12 -12 -12 -9
-12 -12 -12 -8
-12 -12 -12 -7
-12 -12 -12 -6
-12 -12 -12 -5
-12 -12 -12 -4
-12 -12 -12 -3
-12 -12 -12 -2
-12 -12 -12 -1
-12 -12 -12 0
-12 -12 -12 1
-12 -12 -12 2
-12 -12 -12 3
-12 -12 -12 4
-12 -12 -12 5
-12 -12 -12 6
-12 -12 -12 7
-12 -12 -12 8
...

output:

8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
...

result:

ok 388752 lines

Test #3:

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

input:

388752
0 -12 0 -11
0 -12 0 -10
0 -12 0 -9
0 -12 0 -8
0 -12 0 -7
0 -12 0 -6
0 -12 0 -5
0 -12 0 -4
0 -12 0 -3
0 -12 0 -2
0 -12 0 -1
0 -12 0 1
0 -12 0 2
0 -12 0 3
0 -12 0 4
0 -12 0 5
0 -12 0 6
0 -12 0 7
0 -12 0 8
0 -12 0 9
0 -12 0 10
0 -12 0 11
0 -12 0 12
0 -12 1 -12
0 -12 1 -11
0 -12 1 -10
0 -12 1 -9
...

output:

3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 388752 lines

Test #4:

score: 0
Accepted
time: 71ms
memory: 3784kb

input:

388752
-12 0 -12 1
-12 0 -12 2
-12 0 -12 3
-12 0 -12 4
-12 0 -12 5
-12 0 -12 6
-12 0 -12 7
-12 0 -12 8
-12 0 -12 9
-12 0 -12 10
-12 0 -12 11
-12 0 -12 12
-12 0 -12 13
-12 0 -12 14
-12 0 -12 15
-12 0 -12 16
-12 0 -12 17
-12 0 -12 18
-12 0 -12 19
-12 0 -12 20
-12 0 -12 21
-12 0 -12 22
-12 0 -12 23
-12...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
...

result:

ok 388752 lines

Test #5:

score: 0
Accepted
time: 64ms
memory: 3852kb

input:

388752
0 1 0 2
0 1 0 3
0 1 0 4
0 1 0 5
0 1 0 6
0 1 0 7
0 1 0 8
0 1 0 9
0 1 0 10
0 1 0 11
0 1 0 12
0 1 0 13
0 1 0 14
0 1 0 15
0 1 0 16
0 1 0 17
0 1 0 18
0 1 0 19
0 1 0 20
0 1 0 21
0 1 0 22
0 1 0 23
0 1 0 24
0 1 1 0
0 1 1 1
0 1 1 2
0 1 1 3
0 1 1 4
0 1 1 5
0 1 1 6
0 1 1 7
0 1 1 8
0 1 1 9
0 1 1 10
0 1 1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
...

result:

ok 388752 lines

Test #6:

score: 0
Accepted
time: 69ms
memory: 3880kb

input:

388752
-24 -24 -24 -23
-24 -24 -24 -22
-24 -24 -24 -21
-24 -24 -24 -20
-24 -24 -24 -19
-24 -24 -24 -18
-24 -24 -24 -17
-24 -24 -24 -16
-24 -24 -24 -15
-24 -24 -24 -14
-24 -24 -24 -13
-24 -24 -24 -12
-24 -24 -24 -11
-24 -24 -24 -10
-24 -24 -24 -9
-24 -24 -24 -8
-24 -24 -24 -7
-24 -24 -24 -6
-24 -24 -...

output:

14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
13
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
13
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
13
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
13
14
...

result:

ok 388752 lines

Test #7:

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

input:

390000
-2 8 -2 9
-2 8 -2 10
-2 8 -2 11
-2 8 -2 12
-2 8 -2 13
-2 8 -2 14
-2 8 -2 15
-2 8 -2 16
-2 8 -2 17
-2 8 -2 18
-2 8 -2 19
-2 8 -2 20
-2 8 -2 21
-2 8 -2 22
-2 8 -2 23
-2 8 -2 24
-2 8 -2 25
-2 8 -2 26
-2 8 -2 27
-2 8 -2 28
-2 8 -2 29
-2 8 -2 30
-2 8 -2 31
-2 8 -2 32
-2 8 -1 8
-2 8 -1 9
-2 8 -1 10...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 390000 lines

Test #8:

score: 0
Accepted
time: 92ms
memory: 3808kb

input:

390000
989999988 -12 989999988 -11
989999988 -12 989999988 -10
989999988 -12 989999988 -9
989999988 -12 989999988 -8
989999988 -12 989999988 -7
989999988 -12 989999988 -6
989999988 -12 989999988 -5
989999988 -12 989999988 -4
989999988 -12 989999988 -3
989999988 -12 989999988 -2
989999988 -12 9899999...

output:

8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
...

result:

ok 390000 lines

Test #9:

score: 0
Accepted
time: 105ms
memory: 3596kb

input:

390000
989999988 989999988 989999988 989999989
989999988 989999988 989999988 989999990
989999988 989999988 989999988 989999991
989999988 989999988 989999988 989999992
989999988 989999988 989999988 989999993
989999988 989999988 989999988 989999994
989999988 989999988 989999988 989999995
989999988 989...

output:

494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
494999996
...

result:

ok 390000 lines

Test #10:

score: 0
Accepted
time: 91ms
memory: 3804kb

input:

390000
-12 -990000012 -12 -990000011
-12 -990000012 -12 -990000010
-12 -990000012 -12 -990000009
-12 -990000012 -12 -990000008
-12 -990000012 -12 -990000007
-12 -990000012 -12 -990000006
-12 -990000012 -12 -990000005
-12 -990000012 -12 -990000004
-12 -990000012 -12 -990000003
-12 -990000012 -12 -990...

output:

8
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
8
8
8
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
8
...

result:

ok 390000 lines

Test #11:

score: 0
Accepted
time: 88ms
memory: 3872kb

input:

390000
989999988 0 989999988 1
989999988 0 989999988 2
989999988 0 989999988 3
989999988 0 989999988 4
989999988 0 989999988 5
989999988 0 989999988 6
989999988 0 989999988 7
989999988 0 989999988 8
989999988 0 989999988 9
989999988 0 989999988 10
989999988 0 989999988 11
989999988 0 989999988 12
98...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
...

result:

ok 390000 lines

Test #12:

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

input:

9
100 0 99 0
101 0 99 0
102 0 99 0
103 9 99 0
99999 2 99999 0
100000 0 99999 0
0 1 -100000 0
0 2 -100000 1
0 1 -1 0

output:

3
3
3
6
2
3
2
2
3

result:

ok 9 lines

Test #13:

score: 0
Accepted
time: 66ms
memory: 3592kb

input:

390000
8 8 8 9
8 8 8 10
8 8 8 11
8 8 8 12
8 8 8 13
8 8 8 14
8 8 8 15
8 8 8 16
8 8 8 17
8 8 8 18
8 8 8 19
8 8 8 20
8 8 8 21
8 8 8 22
8 8 8 23
8 8 8 24
8 8 8 25
8 8 8 26
8 8 8 27
8 8 8 28
8 8 8 29
8 8 8 30
8 8 8 31
8 8 8 32
8 8 9 8
8 8 9 9
8 8 9 10
8 8 9 11
8 8 9 12
8 8 9 13
8 8 9 14
8 8 9 15
8 8 9 16...

output:

6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6
...

result:

ok 390000 lines

Test #14:

score: 0
Accepted
time: 66ms
memory: 3580kb

input:

390000
18 18 18 19
18 18 18 20
18 18 18 21
18 18 18 22
18 18 18 23
18 18 18 24
18 18 18 25
18 18 18 26
18 18 18 27
18 18 18 28
18 18 18 29
18 18 18 30
18 18 18 31
18 18 18 32
18 18 18 33
18 18 18 34
18 18 18 35
18 18 18 36
18 18 18 37
18 18 18 38
18 18 18 39
18 18 18 40
18 18 18 41
18 18 18 42
18 18...

output:

11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
...

result:

ok 390000 lines

Test #15:

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

input:

390000
-2 18 -2 19
-2 18 -2 20
-2 18 -2 21
-2 18 -2 22
-2 18 -2 23
-2 18 -2 24
-2 18 -2 25
-2 18 -2 26
-2 18 -2 27
-2 18 -2 28
-2 18 -2 29
-2 18 -2 30
-2 18 -2 31
-2 18 -2 32
-2 18 -2 33
-2 18 -2 34
-2 18 -2 35
-2 18 -2 36
-2 18 -2 37
-2 18 -2 38
-2 18 -2 39
-2 18 -2 40
-2 18 -2 41
-2 18 -2 42
-2 18...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

result:

ok 390000 lines

Test #16:

score: 0
Accepted
time: 74ms
memory: 3800kb

input:

388752
-24 -12 -24 -11
-24 -12 -24 -10
-24 -12 -24 -9
-24 -12 -24 -8
-24 -12 -24 -7
-24 -12 -24 -6
-24 -12 -24 -5
-24 -12 -24 -4
-24 -12 -24 -3
-24 -12 -24 -2
-24 -12 -24 -1
-24 -12 -24 0
-24 -12 -24 1
-24 -12 -24 2
-24 -12 -24 3
-24 -12 -24 4
-24 -12 -24 5
-24 -12 -24 6
-24 -12 -24 7
-24 -12 -24 8
...

output:

8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
7
8
8
8
8
8
8
8
8
8
8
8
8
9
...

result:

ok 388752 lines

Test #17:

score: 0
Accepted
time: 64ms
memory: 3916kb

input:

388752
-24 0 -24 1
-24 0 -24 2
-24 0 -24 3
-24 0 -24 4
-24 0 -24 5
-24 0 -24 6
-24 0 -24 7
-24 0 -24 8
-24 0 -24 9
-24 0 -24 10
-24 0 -24 11
-24 0 -24 12
-24 0 -24 13
-24 0 -24 14
-24 0 -24 15
-24 0 -24 16
-24 0 -24 17
-24 0 -24 18
-24 0 -24 19
-24 0 -24 20
-24 0 -24 21
-24 0 -24 22
-24 0 -24 23
-24...

output:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
...

result:

ok 388752 lines