結果

問題 No.1999 Lattice Teleportation
ユーザー MasKoaTSMasKoaTS
提出日時 2022-06-23 18:35:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 749 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 89,940 KB
最終ジャッジ日時 2024-04-25 23:01:39
合計ジャッジ時間 11,447 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,272 KB
testcase_01 AC 36 ms
54,260 KB
testcase_02 AC 35 ms
53,504 KB
testcase_03 AC 36 ms
53,372 KB
testcase_04 AC 40 ms
54,424 KB
testcase_05 AC 50 ms
67,116 KB
testcase_06 AC 48 ms
65,608 KB
testcase_07 AC 44 ms
62,152 KB
testcase_08 AC 37 ms
54,932 KB
testcase_09 AC 35 ms
54,520 KB
testcase_10 AC 35 ms
52,724 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 673 ms
89,940 KB
testcase_14 AC 34 ms
52,904 KB
testcase_15 AC 677 ms
89,684 KB
testcase_16 AC 378 ms
84,736 KB
testcase_17 AC 606 ms
88,316 KB
testcase_18 AC 551 ms
87,164 KB
testcase_19 AC 577 ms
87,580 KB
testcase_20 AC 696 ms
89,696 KB
testcase_21 AC 688 ms
89,812 KB
testcase_22 AC 683 ms
89,828 KB
testcase_23 AC 98 ms
77,156 KB
testcase_24 AC 250 ms
81,204 KB
testcase_25 AC 557 ms
86,576 KB
testcase_26 AC 459 ms
86,292 KB
testcase_27 AC 377 ms
84,616 KB
testcase_28 AC 651 ms
89,356 KB
testcase_29 AC 315 ms
82,944 KB
testcase_30 AC 167 ms
78,704 KB
testcase_31 AC 138 ms
78,480 KB
testcase_32 AC 416 ms
85,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# WA

from math import gcd, atan2
import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7

class Vector2:
	def __init__(self, x: int, y: int):
		self.x = x
		self.y = y

	def __lt__(self, other):
		return atan2(self.y, self.x) < atan2(other.y, other.x)

def area(v1: Vector2, v2: Vector2) -> int:
	return v1.x * v2.y - v1.y * v2.x


n = int(input())
vector = []
for _ in [0] * n:
	x, y = map(int, input().split())
	if(x == 0 and y == 0):
		continue
	if(y < 0):
		x = -x
		y = -y
	vector.append(Vector2(x, y))
vector.sort()

S, bh = 0, 0
lx, ly = 0, 0
for v in vector:
	v1 = Vector2(lx, ly)
	v2 = Vector2(lx + v.x, ly + v.y)
	S += area(v1, v2) % mod
	S %= mod
	bh += gcd(v.x, v.y)
	bh %= mod
	lx, ly = v2.x, v2.y

ans = (S + bh + 1) % mod
print(ans)
0