結果

問題 No.1367 文字列門松
ユーザー mesame3993mesame3993
提出日時 2021-12-09 01:49:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 694 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 71,504 KB
最終ジャッジ日時 2023-09-23 12:58:38
合計ジャッジ時間 3,392 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,240 KB
testcase_01 AC 68 ms
71,232 KB
testcase_02 AC 69 ms
71,168 KB
testcase_03 AC 68 ms
71,176 KB
testcase_04 AC 69 ms
71,236 KB
testcase_05 AC 68 ms
71,480 KB
testcase_06 AC 66 ms
71,356 KB
testcase_07 AC 69 ms
71,296 KB
testcase_08 AC 69 ms
71,224 KB
testcase_09 AC 69 ms
71,220 KB
testcase_10 AC 68 ms
71,248 KB
testcase_11 AC 68 ms
71,260 KB
testcase_12 AC 68 ms
71,248 KB
testcase_13 AC 72 ms
71,348 KB
testcase_14 AC 68 ms
71,264 KB
testcase_15 WA -
testcase_16 AC 66 ms
71,120 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 67 ms
71,256 KB
testcase_24 AC 66 ms
71,128 KB
testcase_25 AC 68 ms
71,188 KB
testcase_26 AC 69 ms
71,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  readline = stdin.readline
  s = readline()[:-1]
  n = len(s)
  t = 'kadomatsu'
  if n > len(t):
    print('No')
    exit()
  arr_t = [x for x in t]
  delta1 = []
  delta2 = []
  for i in range(n):
    if s[i] in arr_t:
      delta1.append(arr_t.index(s[i]))
      arr_t.remove(s[i])
      if s[i] in arr_t:
        delta2.append(arr_t.index(s[i]))
    else:
      print('No')
      exit()
  flag = (delta1 == list(sorted(delta1)) or delta2 == list(sorted(delta2)))
  print('Yes' if flag else 'No')


  
if __name__ == "__main__":
  import sys
  readline = sys.stdin.readline
  def error(*args, end='\n'):
    print(*args, end=end, file=sys.stderr)
  main()
0