結果

問題 No.1341 真ん中を入れ替えて門松列
ユーザー kozykozy
提出日時 2021-01-15 22:35:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-05-05 00:38:06
合計ジャッジ時間 1,737 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 31 ms
10,880 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 46 ms
11,520 KB
testcase_08 AC 49 ms
11,648 KB
testcase_09 AC 50 ms
11,776 KB
testcase_10 AC 50 ms
11,520 KB
testcase_11 WA -
testcase_12 AC 51 ms
11,648 KB
testcase_13 AC 51 ms
11,648 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 51 ms
11,776 KB
testcase_17 AC 50 ms
11,648 KB
testcase_18 AC 47 ms
11,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
L=list()
R=list()
D=list()
for i in range(N):
    A,B,C=map(int,input().split())
    if i==0:
      s={A,C}
    else:
      s&={A,C}
    L.append(B)
    R.append([A,B,C])
    D.append([max(A,C),i])
    if A==C:
      print("NO")
      exit()
L.sort()
L.reverse()
D.sort()
thi=0
ans=0
usiro=N-1
s=list(s)
if len(s)==1:
  if s[0] in L:
    print("NO")
    exit()
if len(s)==2:
  if s[0] in L:
    print("NO")
    exit()
  if s[1] in L:
    print("NO")
    exit()
for i in range(N):
    a,b=D[i]
    if L[thi]>a:
        ans+=L[thi]
    else:
        if L[usiro]<min(R[b][0],R[b][2]):
            ans+=a
        else:
            print("NO")
            exit()
print("YES")
if ans>=M:
    print("KADOMATSU!")
else:
    print("NO")
0