結果
問題 | No.849 yuki国の分割統治 |
ユーザー | mkawa2 |
提出日時 | 2019-07-06 21:09:58 |
言語 | Python3 (3.11.6 + numpy 1.26.0 + scipy 1.11.3) |
結果 |
AC
|
実行時間 | 425 ms / 2,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 132 ms |
コンパイル使用メモリ | 10,928 KB |
実行使用メモリ | 42,872 KB |
最終ジャッジ日時 | 2023-07-29 00:45:38 |
合計ジャッジ時間 | 9,422 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,768 KB |
testcase_01 | AC | 16 ms
7,748 KB |
testcase_02 | AC | 17 ms
7,776 KB |
testcase_03 | AC | 17 ms
7,736 KB |
testcase_04 | AC | 17 ms
7,748 KB |
testcase_05 | AC | 16 ms
7,776 KB |
testcase_06 | AC | 16 ms
7,744 KB |
testcase_07 | AC | 346 ms
28,836 KB |
testcase_08 | AC | 347 ms
36,540 KB |
testcase_09 | AC | 379 ms
39,700 KB |
testcase_10 | AC | 400 ms
41,276 KB |
testcase_11 | AC | 331 ms
35,116 KB |
testcase_12 | AC | 370 ms
38,992 KB |
testcase_13 | AC | 404 ms
40,012 KB |
testcase_14 | AC | 381 ms
40,200 KB |
testcase_15 | AC | 328 ms
34,980 KB |
testcase_16 | AC | 422 ms
42,852 KB |
testcase_17 | AC | 377 ms
42,704 KB |
testcase_18 | AC | 421 ms
42,852 KB |
testcase_19 | AC | 423 ms
42,872 KB |
testcase_20 | AC | 425 ms
42,808 KB |
testcase_21 | AC | 370 ms
39,464 KB |
testcase_22 | AC | 414 ms
42,704 KB |
testcase_23 | AC | 415 ms
42,808 KB |
testcase_24 | AC | 398 ms
42,712 KB |
testcase_25 | AC | 422 ms
42,808 KB |
testcase_26 | AC | 15 ms
7,824 KB |
testcase_27 | AC | 16 ms
7,828 KB |
testcase_28 | AC | 16 ms
7,860 KB |
testcase_29 | AC | 16 ms
7,780 KB |
ソースコード
a, b, c, d = map(int, input().split()) n = int(input()) xy = [list(map(int, input().split())) for _ in range(n)] # 横移動 if a == c == 0: while b > 0: d, b = b, d % b else: if a < c: a, b, c, d = c, d, a, b while c > 0: r = a // c a, b, c, d = c, d, a - r * c, b - r * d d = abs(d) xy=[[x % a, y - b * (x // a)] for x,y in xy] ki = set() # 縦移動 if d: for x, y in xy: ki.add((x, y % d)) else: for x, y in xy: ki.add((x, y)) print(len(ki))