結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2018-06-04 02:39:37 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 409 bytes |
コンパイル時間 | 2,661 ms |
コンパイル使用メモリ | 62,728 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 09:31:57 |
合計ジャッジ時間 | 3,674 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
import sequtils let S = stdin.readLine var progress, length = newSeqWith(0, 0) var best = int.high for s in S: case s: of 'c': progress.add(1) length.add(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)]