結果

問題 No.360 増加門松列
ユーザー mkawa2mkawa2
提出日時 2019-12-26 22:21:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,925 bytes
コンパイル時間 1,538 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 44,280 KB
最終ジャッジ日時 2024-04-15 11:28:09
合計ジャッジ時間 15,743 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 537 ms
44,280 KB
testcase_01 AC 529 ms
43,900 KB
testcase_02 AC 532 ms
43,896 KB
testcase_03 WA -
testcase_04 AC 532 ms
44,148 KB
testcase_05 AC 528 ms
43,780 KB
testcase_06 AC 527 ms
44,148 KB
testcase_07 AC 526 ms
44,024 KB
testcase_08 AC 529 ms
43,896 KB
testcase_09 AC 526 ms
43,772 KB
testcase_10 AC 524 ms
44,276 KB
testcase_11 AC 530 ms
43,896 KB
testcase_12 AC 525 ms
43,780 KB
testcase_13 AC 535 ms
43,784 KB
testcase_14 AC 539 ms
43,908 KB
testcase_15 AC 524 ms
43,768 KB
testcase_16 AC 527 ms
44,168 KB
testcase_17 AC 526 ms
44,276 KB
testcase_18 AC 523 ms
43,912 KB
testcase_19 AC 526 ms
44,280 KB
testcase_20 AC 526 ms
43,772 KB
testcase_21 AC 528 ms
44,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *
from bisect import *
from math import *
from collections import *
from heapq import *
from random import *
import numpy as np
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij=[(1,0),(0,1),(-1,0),(0,-1)]

def main():
    def check(aa):
        for a0,a1,a2 in zip(aa,aa[1:],aa[2:]):
            if a0==a1 or a1==a2 or a0==a2:return False
            if a0<=a1<=a2:return False
        return True

    dd=LI()
    dd.sort()
    for i in range(5):
        if dd[i]==dd[i+1]==dd[i+2]:
            print("NO")
            exit()
    small=[]
    big=[]
    si=-1
    while len(small)<3:
        si+=1
        if si!=0 and dd[si]==dd[si-1]:
            big.append(dd[si])
            continue
        small.append(dd[si])
    for i in range(si+1,7):
        big.append(dd[i])

    aa=[]
    for i in range(4):
        aa.append(big[i])
        if i==3:break
        aa.append(small[i])
    if check(aa):
        print("YES")
        exit()

    small=[]
    big=[]
    si=-1
    while len(small)<4:
        si+=1
        if si!=0 and dd[si]==dd[si-1]:
            big.append(dd[si])
            continue
        small.append(dd[si])
    for i in range(si+1,7):
        big.append(dd[i])

    aa=[]
    for i in range(4):
        aa.append(small[i])
        if i==3:break
        aa.append(big[i])
    if check(aa):
        print("YES")
        exit()
    print("NO")

main()
0