結果
問題 | No.5009 Draw A Convex Polygon |
ユーザー | mkawa2 |
提出日時 | 2022-12-03 18:26:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 84 ms / 2,600 ms |
コード長 | 1,618 bytes |
コンパイル時間 | 967 ms |
実行使用メモリ | 90,408 KB |
スコア | 80 |
平均クエリ数 | 81.00 |
最終ジャッジ日時 | 2022-12-03 18:26:14 |
合計ジャッジ時間 | 2,126 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
純コード判定しない問題か言語 |
(要ログイン)
ソースコード
import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 def rot90(xx, yy): nx, ny = [], [] for x, y in zip(xx, yy): nx.append(-y) ny.append(x) return nx, ny n = 80 l = (n-8)//8 si = [0, 1] bo = [1, 1] a = 1 while len(si) < l+2: a += 1 ps, pb = si, bo si, bo = [], [] for s, b in zip(ps, pb): if bo and bo[-1]+b == a: si.append(si[-1]+s) bo.append(bo[-1]+b) si.append(s) bo.append(b) si = si[1:l+1] bo = bo[1:l+1] # print(n, len(si), sum(bo)) # print(si) # print(bo) xx = [1] yy = [-sum(si)-sum(bo)-2] for s, b in zip(si, bo): xx.append(xx[-1]+b) yy.append(yy[-1]+s) xx.append(xx[-1]+1) yy.append(yy[-1]+1) for b, s in zip(si[::-1], bo[::-1]): xx.append(xx[-1]+b) yy.append(yy[-1]+s) # print(xx) # print(yy) print(n, flush=True) for _ in range(4): for x, y in zip(xx, yy): print(x, y, flush=True) xx, yy = rot90(xx, yy)