結果
| 問題 |
No.345 最小チワワ問題
|
| コンテスト | |
| ユーザー |
toshiro_yanagi
|
| 提出日時 | 2018-06-04 02:27:53 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 449 bytes |
| コンパイル時間 | 2,853 ms |
| コンパイル使用メモリ | 62,708 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 09:31:51 |
| 合計ジャッジ時間 | 3,537 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
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':
if progress.len == 0: continue
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)]
toshiro_yanagi