結果
| 問題 |
No.1144 Triangles
|
| コンテスト | |
| ユーザー |
ayaoni
|
| 提出日時 | 2021-07-13 17:33:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,154 bytes |
| コンパイル時間 | 200 ms |
| コンパイル使用メモリ | 82,364 KB |
| 実行使用メモリ | 82,832 KB |
| 最終ジャッジ日時 | 2024-07-02 14:05:03 |
| 合計ジャッジ時間 | 27,553 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 RE * 3 |
ソースコード
import sys
from math import sqrt
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())
N = I()
points = [tuple(MI()) for _ in range(N)]
mod = 10**9+7
ans = 0
for i in range(N-2):
x0,y0 = points[i]
P = []
for j in range(i+1,N):
x1,y1 = points[j]
x,y = x1-x0,y1-y0
if x == y == 0:
continue
if y < 0:
x,y = -x,-y
cos = x/sqrt(x**2+y**2)
P.append((cos,x,y))
P.sort(reverse=True)
sum_X = [0]*(N-i-1)
sum_Y = [0]*(N-i-1)
for j in range(1,N-i-1):
c,x,y = P[j]
sum_X[j] = sum_X[j-1]+x
sum_Y[j] = sum_Y[j-1]+y
for j in range(N-i-1):
c,x,y = P[j]
ans += x*(sum_Y[-1]-sum_Y[j])-y*(sum_X[-1]-sum_X[j])
ans %= mod
print(ans)
ayaoni