結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2018-06-04 02:23:23 |
言語 | Nim (2.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 447 bytes |
コンパイル時間 | 2,777 ms |
コンパイル使用メモリ | 62,552 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 09:30:56 |
合計ジャッジ時間 | 3,638 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 8 |
ソースコード
import sequtils, algorithm let S = stdin.readLine var progress, length = newSeqWith(0, 0) var best = int.high for i, s in S: case s: of 'c': length.add(1) progress.add(0) progress.fill(1) of 'w': for i, v in progress: progress[i] += 1 if progress[i] == 3: best = min(length[i], best) else: discard for i, v in length: length[i] += 1 echo [best, -1][int(best == int.high)]