結果
| 問題 |
No.360 増加門松列
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-26 15:43:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 64 ms / 2,000 ms |
| コード長 | 794 bytes |
| コンパイル時間 | 1,818 ms |
| コンパイル使用メモリ | 81,688 KB |
| 実行使用メモリ | 71,340 KB |
| 最終ジャッジ日時 | 2025-03-26 15:43:12 |
| 合計ジャッジ時間 | 2,781 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
import sys
from itertools import permutations
from collections import Counter
def main():
D = list(map(int, sys.stdin.readline().split()))
cnt = Counter(D)
for count in cnt.values():
if count >= 4:
print("NO")
return
for perm in permutations(D):
valid = True
for i in range(5):
a, b, c = perm[i], perm[i+1], perm[i+2]
if a == b or b == c or a == c:
valid = False
break
if not (b == max(a, b, c) or b == min(a, b, c)):
valid = False
break
if a >= c:
valid = False
break
if valid:
print("YES")
return
print("NO")
if __name__ == "__main__":
main()
lam6er