結果

問題 No.5009 Draw A Convex Polygon
ユーザー ra5anchor
提出日時 2025-04-27 16:11:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,043 ms / 2,600 ms
コード長 1,032 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 310,032 KB
スコア 1,000,000
平均クエリ数 1000001.00
最終ジャッジ日時 2025-04-27 16:11:09
合計ジャッジ時間 5,105 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

N = 10**6
L = []
for i in range(1, 700):
    for j in range(1, 700):
        L.append((j/i, i, j))
L.sort()
# print(L)

nowx = 1
nowy = -10**9 + 1
nowslope = -1

points = [(nowx, nowy)]
NN = len(L)
for i in range(1, NN):
    slope = L[i][0]
    x, y = L[i][1], L[i][2]
    if slope <= nowslope:
        continue
    
    nowx += x
    nowy += y
    nowslope = slope
    points.append((nowx, nowy))
    if len(points) == N // 4:
        break
    # ans.append(str(nowx) + ' ' + str(nowy))

points2 = []
points3 = []
points4 = []

for (x, y) in points:
    points2.append((x, -y))
    points3.append((-x, -y))
    points4.append((-x, y))

points2.reverse()
points4.reverse()

ans = []
for x, y in points:
    ans.append(str(x) + ' ' + str(y))
for x, y in points2:
    ans.append(str(x) + ' ' + str(y))
for x, y in points3:
    ans.append(str(x) + ' ' + str(y))
for x, y in points4:
    ans.append(str(x) + ' ' + str(y))

print(N)
print('\n'.join(ans))
# for i in range(N):
#     print(ans[i][0], ans[i][1])

# print(NN, N, len(ans))

0