結果

問題 No.2797 Square Tile
ユーザー tassei903tassei903
提出日時 2024-06-28 22:59:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 907 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 78,848 KB
最終ジャッジ日時 2024-06-28 22:59:21
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,224 KB
testcase_01 AC 36 ms
51,968 KB
testcase_02 AC 34 ms
51,968 KB
testcase_03 AC 33 ms
51,968 KB
testcase_04 AC 69 ms
78,848 KB
testcase_05 AC 73 ms
78,460 KB
testcase_06 AC 66 ms
77,056 KB
testcase_07 AC 36 ms
52,864 KB
testcase_08 AC 55 ms
70,272 KB
testcase_09 AC 63 ms
77,100 KB
testcase_10 AC 66 ms
78,012 KB
testcase_11 AC 65 ms
76,916 KB
testcase_12 AC 69 ms
76,800 KB
testcase_13 AC 60 ms
71,168 KB
testcase_14 AC 63 ms
76,928 KB
testcase_15 AC 62 ms
76,288 KB
testcase_16 AC 61 ms
76,160 KB
testcase_17 AC 53 ms
70,400 KB
testcase_18 AC 54 ms
68,608 KB
testcase_19 AC 60 ms
76,756 KB
testcase_20 AC 61 ms
76,800 KB
testcase_21 AC 69 ms
77,952 KB
testcase_22 AC 53 ms
71,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""
111
111
111
00111
00111
00111


11
11
 11
 11

"""

a, b = map(int, input().split())
N = a**2 + b**2

ans = []
from math import gcd
g = gcd(a, b)
for i in range(g):
    for j in range(N//g):
        x = (j * b+ b + a * i) % N
        y = (j * a - b * i) % N
        ans.append((x, y))

for i in range(g):
    for j in range(N//g):
        x = (j * b+ a * i) % N
        y = (j * a - b*i) % N
        ans.append((x, y))
# s = [[0] * (N) for i in range(N)]
# for i in range(N):
#     x,y = ans[i]
#     for dx in range(a):
#         for dy in range(a):
#             assert s[(x+dx)%N][(y+dy)%N] == 0
#             s[(x+dx)%N][(y+dy)%N] = 1
# assert len(ans) == 2 * N
# for i in range(N):
#     x,y = ans[i+N]
#     for dx in range(b):
#         for dy in range(b):
#             assert s[(x+dx)%N][(y+dy)%N] == 0
#             s[(x+dx)%N][(y+dy)%N] = 1
                

for i, j in ans:
    print(i, j)
0