結果
| 問題 | No.2773 Wake up Record 1 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-08 00:29:57 |
| 言語 | Standard ML (MLton 20241230) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 1,140 bytes |
| 記録 | |
| コンパイル時間 | 2,308 ms |
| コンパイル使用メモリ | 706,188 KB |
| 実行使用メモリ | 19,940 KB |
| 最終ジャッジ日時 | 2026-04-08 00:30:05 |
| 合計ジャッジ時間 | 4,407 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
fun readInt () =
valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn)
fun readStr () =
let
fun scan reader stream = SOME (StringCvt.splitl (not o Char.isSpace) reader (StringCvt.skipWS reader stream))
in
valOf (TextIO.scanStream scan TextIO.stdIn)
end
datatype state = Sleeping | Awake
fun findAns _ _ [] acc = List.rev acc
| findAns index Sleeping (h :: tl) acc =
if h = #"o"
then findAns (index + 1) Awake tl (index :: acc)
else findAns (index + 1) Sleeping tl acc
| findAns index Awake (h :: tl) acc =
if h = #"o"
then findAns (index + 1) Awake tl acc
else findAns (index + 1) Sleeping tl acc
fun printList [] = print "\n"
| printList [x] =
(
print (Int.toString x);
printList []
)
| printList (h :: tl) =
(
print (Int.toString h);
print " ";
printList tl
)
val () =
let
val n = readInt ()
val s = readStr ()
val ans = findAns 1 Sleeping (String.explode s) []
in
(
print (Int.toString (List.length ans) ^ "\n");
printList ans
)
end