結果
問題 | No.345 最小チワワ問題 |
ユーザー |
|
提出日時 | 2024-12-26 19:15:48 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 734 bytes |
コンパイル時間 | 629 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-26 19:15:51 |
合計ジャッジ時間 | 2,793 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 8 WA * 21 |
ソースコード
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 == "c" and first_c is not None and first_w 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(first_c, first_w, second_w) print(second_w - first_c + 1) if __name__ == "__main__": main()