結果

問題 No.274 The Wall
ユーザー roarisroaris
提出日時 2019-12-06 14:42:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 942 bytes
コンパイル時間 1,969 ms
コンパイル使用メモリ 86,848 KB
実行使用メモリ 77,880 KB
最終ジャッジ日時 2023-08-24 19:57:23
合計ジャッジ時間 5,361 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,128 KB
testcase_01 AC 77 ms
76,060 KB
testcase_02 AC 81 ms
75,884 KB
testcase_03 AC 95 ms
76,660 KB
testcase_04 AC 70 ms
71,228 KB
testcase_05 AC 71 ms
71,280 KB
testcase_06 AC 71 ms
71,128 KB
testcase_07 AC 71 ms
71,316 KB
testcase_08 AC 72 ms
71,508 KB
testcase_09 AC 76 ms
76,308 KB
testcase_10 AC 80 ms
76,120 KB
testcase_11 AC 97 ms
76,748 KB
testcase_12 AC 229 ms
77,608 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 100 ms
76,876 KB
testcase_17 AC 102 ms
76,948 KB
testcase_18 AC 100 ms
76,860 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 143 ms
77,764 KB
testcase_23 AC 141 ms
77,660 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
LR = [tuple(map(int, input().split())) for _ in range(N)]
locked = [False]*N

for i in range(M):
    flag = False
    
    for j in range(N):
        Lj, Rj = LR[j]
        
        if Lj<=i<=Rj:
            if not flag:
                flag = True
            else:
                if locked[j]:
                    print('NO')
                    exit()
                else:
                    Lj, Rj = M-1-Rj, M-1-Lj
                    
                    if Lj<=i<=Rj:
                        print('NO')
                        exit()
                    
                    LR[j] = (Lj, Rj)
                    locked[j] = True

for i in range(N):
    flag = False
    
    for j in range(N):
        Lj, Rj = LR[j]
        
        if Lj<=i<=Rj:
            if not flag:
                flag = True
            else:
                print('NO')
                exit()
                
print('YES')
0