結果
問題 | No.1183 コイン遊び |
ユーザー | Theta |
提出日時 | 2022-10-18 12:11:35 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 748 bytes |
コンパイル時間 | 235 ms |
コンパイル使用メモリ | 10,848 KB |
実行使用メモリ | 47,772 KB |
最終ジャッジ日時 | 2023-09-11 06:44:32 |
合計ジャッジ時間 | 8,855 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 132 ms
33,848 KB |
testcase_01 | AC | 131 ms
29,256 KB |
testcase_02 | AC | 133 ms
29,388 KB |
testcase_03 | AC | 133 ms
29,444 KB |
testcase_04 | AC | 131 ms
29,296 KB |
testcase_05 | AC | 131 ms
29,392 KB |
testcase_06 | AC | 134 ms
29,548 KB |
testcase_07 | AC | 136 ms
29,460 KB |
testcase_08 | AC | 142 ms
29,392 KB |
testcase_09 | AC | 143 ms
29,564 KB |
testcase_10 | AC | 339 ms
29,796 KB |
testcase_11 | AC | 1,060 ms
31,140 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
ソースコード
import numpy as np def main(): N = int(input()) A = np.array(list(map(lambda letter: bool(int(letter)), input().split()))) B = np.array(list(map(lambda letter: bool(int(letter)), input().split()))) left_idx = 0 right_idx = N - 1 ctr = 0 while not np.array_equal(A, B): if left_idx == right_idx: if A[left_idx] != B[left_idx]: ctr += 1 break if A[left_idx] == B[left_idx]: left_idx += 1 continue if A[right_idx] == B[right_idx]: right_idx -= 1 continue A[left_idx:right_idx+1] = np.logical_not(A[left_idx:right_idx+1]) ctr += 1 print(ctr) if __name__ == "__main__": main()