結果

問題 No.360 増加門松列
ユーザー pluto77pluto77
提出日時 2016-10-26 10:35:26
言語 Python2
(2.7.18)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 55 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2023-08-25 18:40:30
合計ジャッジ時間 1,319 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
6,548 KB
testcase_01 AC 18 ms
6,412 KB
testcase_02 AC 13 ms
6,416 KB
testcase_03 AC 13 ms
6,372 KB
testcase_04 AC 17 ms
6,336 KB
testcase_05 AC 16 ms
6,336 KB
testcase_06 AC 17 ms
6,484 KB
testcase_07 AC 16 ms
6,344 KB
testcase_08 AC 17 ms
6,340 KB
testcase_09 AC 16 ms
6,368 KB
testcase_10 AC 13 ms
6,548 KB
testcase_11 AC 13 ms
6,340 KB
testcase_12 AC 16 ms
6,412 KB
testcase_13 AC 13 ms
6,392 KB
testcase_14 AC 13 ms
6,416 KB
testcase_15 AC 15 ms
6,408 KB
testcase_16 AC 13 ms
6,448 KB
testcase_17 AC 13 ms
6,500 KB
testcase_18 AC 16 ms
6,344 KB
testcase_19 AC 17 ms
6,448 KB
testcase_20 AC 16 ms
6,444 KB
testcase_21 AC 17 ms
6,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki_360
import itertools
import sys

def kado(s):
 l=len(s)
 for i in xrange(l-2):
  if (s[i]<s[i+1]>s[i+2] or s[i]>s[i+1]<s[i+2]) and s[i]<s[i+2]:
   continue
  else:
   return False
 return True

a=map(int,raw_input().split())
plist=list(itertools.permutations(a))
#for i in xrange(len(plist)):
# print plist[i],kado(plist[i])
for i in xrange(len(plist)):
 if kado(plist[i])==True:
  print "YES"
  sys.exit()
print "NO"
0