結果
問題 | No.849 yuki国の分割統治 |
ユーザー | mkawa2 |
提出日時 | 2019-07-06 21:09:58 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 548 ms / 2,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 109 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 45,312 KB |
最終ジャッジ日時 | 2024-04-16 08:35:52 |
合計ジャッジ時間 | 11,241 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
10,624 KB |
testcase_01 | AC | 31 ms
10,752 KB |
testcase_02 | AC | 33 ms
10,624 KB |
testcase_03 | AC | 34 ms
10,624 KB |
testcase_04 | AC | 35 ms
10,624 KB |
testcase_05 | AC | 33 ms
10,752 KB |
testcase_06 | AC | 31 ms
10,752 KB |
testcase_07 | AC | 440 ms
31,488 KB |
testcase_08 | AC | 460 ms
39,168 KB |
testcase_09 | AC | 499 ms
42,496 KB |
testcase_10 | AC | 530 ms
44,032 KB |
testcase_11 | AC | 437 ms
37,632 KB |
testcase_12 | AC | 485 ms
41,472 KB |
testcase_13 | AC | 519 ms
42,624 KB |
testcase_14 | AC | 490 ms
42,752 KB |
testcase_15 | AC | 436 ms
37,632 KB |
testcase_16 | AC | 548 ms
45,312 KB |
testcase_17 | AC | 497 ms
45,184 KB |
testcase_18 | AC | 540 ms
45,312 KB |
testcase_19 | AC | 537 ms
45,184 KB |
testcase_20 | AC | 533 ms
45,184 KB |
testcase_21 | AC | 487 ms
42,240 KB |
testcase_22 | AC | 524 ms
45,312 KB |
testcase_23 | AC | 539 ms
45,184 KB |
testcase_24 | AC | 516 ms
45,184 KB |
testcase_25 | AC | 543 ms
45,312 KB |
testcase_26 | AC | 31 ms
10,752 KB |
testcase_27 | AC | 30 ms
10,752 KB |
testcase_28 | AC | 30 ms
10,752 KB |
testcase_29 | AC | 30 ms
10,624 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))