結果

問題 No.1469 programing
ユーザー harurunharurun
提出日時 2021-04-03 13:36:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,061 ms / 3,000 ms
コード長 540 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 17,844 KB
最終ジャッジ日時 2023-08-26 04:19:22
合計ジャッジ時間 4,409 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,844 KB
testcase_01 AC 16 ms
7,756 KB
testcase_02 AC 15 ms
7,804 KB
testcase_03 AC 16 ms
7,828 KB
testcase_04 AC 16 ms
7,800 KB
testcase_05 AC 17 ms
7,872 KB
testcase_06 AC 16 ms
7,936 KB
testcase_07 AC 17 ms
7,768 KB
testcase_08 AC 59 ms
8,232 KB
testcase_09 AC 75 ms
8,248 KB
testcase_10 AC 69 ms
8,164 KB
testcase_11 AC 106 ms
8,632 KB
testcase_12 AC 83 ms
8,420 KB
testcase_13 AC 15 ms
7,828 KB
testcase_14 AC 137 ms
8,616 KB
testcase_15 AC 139 ms
8,644 KB
testcase_16 AC 222 ms
8,888 KB
testcase_17 AC 2,061 ms
17,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#変更後assert
def main():
  S=input()
  assert(1<=len(S)<=5*(10**6))
  #英小文字かどうか
  for i in S:
    assert(ord("a")<=ord(i)<=ord("z"))
  if len(S)>2:
    #3文字以上続いてないか(3文字続いているかの確認で3文字以上も確認できる)
    for i in range(len(S)-2):
      if S[i]==S[i+1] and S[i+1]==S[i+2]:
        raise Exception("3 or more continues.")
  if len(S)<2:
    print(S)
    return
  ans=S[0]
  for i in range(1,len(S)):
    if S[i-1]!=S[i]:
      ans+=S[i]
  print(ans)
  return

main()
0