結果
問題 | No.345 最小チワワ問題 |
ユーザー |
|
提出日時 | 2024-12-26 19:12:24 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 603 bytes |
コンパイル時間 | 461 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-12-26 19:12:27 |
合計ジャッジ時間 | 2,133 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 14 |
ソースコード
def main(): input_string = input() first_c = None first_w = None second_w = None for i, s in enumerate(input_string): if s == "c" and first_c is None: first_c = i if s == "w" and first_w is None and first_c is not None: first_w = i if s == "w" and second_w is None and first_c is not None and first_w is not None and first_w != i: second_w = i if any([first_c is None, first_w is None, second_w is None]): print(-1) else: print(second_w - first_c + 1) if __name__ == "__main__": main()