結果
問題 | No.1999 Lattice Teleportation |
ユーザー | MasKoaTS |
提出日時 | 2022-06-23 18:41:07 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 864 bytes |
コンパイル時間 | 414 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 103,364 KB |
最終ジャッジ日時 | 2024-04-25 23:02:02 |
合計ジャッジ時間 | 7,084 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 111 ms
87,232 KB |
testcase_01 | AC | 113 ms
80,240 KB |
testcase_02 | AC | 112 ms
80,136 KB |
testcase_03 | AC | 114 ms
80,352 KB |
testcase_04 | AC | 237 ms
83,324 KB |
testcase_05 | AC | 348 ms
83,536 KB |
testcase_06 | AC | 348 ms
84,060 KB |
testcase_07 | AC | 321 ms
84,008 KB |
testcase_08 | AC | 225 ms
82,700 KB |
testcase_09 | AC | 115 ms
80,252 KB |
testcase_10 | AC | 117 ms
80,200 KB |
testcase_11 | AC | 362 ms
83,876 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
# WA from math import gcd from decimal import Decimal as dec import sys input = sys.stdin.readline mod = 10 ** 9 + 7 INF = dec(10 ** 10) class Vector2: def __init__(self, x: int, y: int): self.x = x self.y = y def __lt__(self, other): return atan2(self.x, self.y) < atan2(other.x, other.y) def area(v1: Vector2, v2: Vector2) -> int: return v1.x * v2.y - v1.y * v2.x def atan2(x, y): if(x == 0): return INF return dec(y) / dec(x) n = int(input()) vector = [] for _ in [0] * n: x, y = map(int, input().split()) if(x == 0 and y == 0): continue if(x < 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)