結果

問題 No.154 市バス
ユーザー むらためむらため
提出日時 2019-01-30 06:45:31
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 564 bytes
コンパイル時間 3,908 ms
コンパイル使用メモリ 66,436 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 03:16:31
合計ジャッジ時間 2,524 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,380 KB
testcase_01 AC 8 ms
4,376 KB
testcase_02 AC 8 ms
4,380 KB
testcase_03 AC 9 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 5 ms
4,376 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

template times*(n:int,body) = (for _ in 0..<n: body)
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': return
    result = 10 * result + k.ord - '0'.ord

scan().times:
  var isOk = true
  var gcount = 0
  while true:
    let k = getchar_unlocked()
    if k < 'A' or k > 'Z': break
    if k == 'G': gcount += 1
    if k == 'R':
      if gcount == 0 : isOk = false
      gcount -= 1
  if not isOk or gcount > 0: echo "impossible"
  else: echo "possible"
0