結果
問題 | No.99 ジャンピング駒 |
ユーザー |
|
提出日時 | 2022-10-28 13:45:51 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 78 ms / 5,000 ms |
コード長 | 386 bytes |
コンパイル時間 | 81 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,872 KB |
最終ジャッジ日時 | 2024-07-05 18:43:58 |
合計ジャッジ時間 | 1,174 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
ソースコード
def main(): N = int(input()) X = list(map(int, input().split())) if N == 1: print(1) stack = [] for next_ in X: if not stack: stack.append(next_) continue if (stack[-1] ^ next_) & 1: stack.pop() else: stack.append(next_) print(len(stack)) if __name__ == "__main__": main()