結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー むらためむらため
提出日時 2019-01-23 22:54:44
言語 Nim
(2.0.0)
結果
WA  
実行時間 -
コード長 879 bytes
コンパイル時間 3,206 ms
コンパイル使用メモリ 70,884 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 02:39:47
合計ジャッジ時間 5,040 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 WA -
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 WA -
testcase_42 AC 2 ms
4,376 KB
testcase_43 WA -
testcase_44 AC 2 ms
4,380 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,376 KB
testcase_47 AC 2 ms
4,384 KB
testcase_48 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,algorithm
template `max=`*(x,y) = x = max(x,y)
proc toArray(s:string) :seq[char] = toSeq(s.items)
proc countMax[T](arr:seq[T],item:T) : int =
  if arr.len == 0 : return 0
  var pre = arr[0]
  var cnt = 0
  for i in 1..<arr.len:
    let a = arr[i]
    if a == pre: cnt += 1
    else:
      if pre == item : result .max= cnt
      cnt = 1
      pre = a
  if arr[^1] == item : result .max= cnt
let n = stdin.readLine().parseInt()
let S = stdin.readLine() & stdin.readLine()
let X = "x".repeat(n)
let O = "o".repeat(n).toArray()
let T = (X & S & X).toArray()
proc overWrite(dst:seq[char],startIndex:int) : seq[char] =
  result = dst
  for i in 0..<n:
    if startIndex + i >= dst.len : return @[]
    if result[startIndex + i ] == 'o' : return @[]
    result[startIndex + i] = 'o'
var ans = 0
for i in 0..28:
  ans .max= T.overWrite(i).countMax('o')
echo ans
0