結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2018-06-04 02:19:16 |
言語 | Nim (2.2.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 412 bytes |
コンパイル時間 | 2,609 ms |
コンパイル使用メモリ | 62,940 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-30 09:30:31 |
合計ジャッジ時間 | 3,666 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 RE * 6 |
ソースコード
import sequtils let S = stdin.readLine var progress, length = newSeqWith(0, 0) var best = int.high for i, 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(progress.max < 3)]