結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー kurenaifkurenaif
提出日時 2016-08-16 21:39:54
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 720 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 7,996 KB
最終ジャッジ日時 2023-08-25 23:51:49
合計ジャッジ時間 2,187 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 14 ms
7,800 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 14 ms
7,728 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 13 ms
7,808 KB
testcase_29 WA -
testcase_30 AC 14 ms
7,924 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 14 ms
7,808 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 13 ms
7,900 KB
testcase_47 WA -
testcase_48 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:19: SyntaxWarning: "is" with a literal. Did you mean "=="?
  tar = 'x' if (tar is 'o') else 'o'
Main.py:33: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(cntarray) % 2 is 0:
Main.py:38: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if C[0] is 'o':

ソースコード

diff #

#!/usr/bin/python3

D = int(input())
C = input()
C += input()

tar = 'o'

cntarray = []

cnt = 0

for i in range(len(C)):
    if C[i] is tar:
        cnt = cnt+1
    else:
        cntarray.append(cnt)
        cnt = 1
        tar = 'x' if (tar is 'o') else 'o'


cntarray.append(cnt)

ma = 0

for i in range(0, len(cntarray)-2, 2):
    if cntarray[i+1] <= D:
        ma = max(ma, cntarray[i]+cntarray[i+1]+cntarray[i+2])
    else:
        ma = max(ma, cntarray[i]+D)
        ma = max(ma, cntarray[i+2]+D)

if len(cntarray) % 2 is 0:
    ma = max(ma, cntarray[-2]+D)
else:
    ma = max(ma,cntarray[-1]+D)

if C[0] is 'o':
    ma = max(ma, cntarray[0]+D)
elif len(cntarray) > 2:
    ma = max(ma, cntarray[2]+D)


print(ma)
0