結果
問題 | No.274 The Wall |
ユーザー |
![]() |
提出日時 | 2020-03-12 21:58:25 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 543 ms / 2,000 ms |
コード長 | 783 bytes |
コンパイル時間 | 130 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 44,736 KB |
最終ジャッジ日時 | 2024-06-22 02:35:54 |
合計ジャッジ時間 | 15,432 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#!/usr/bin/env python3.8# %%import sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlinesimport numpy as npfrom operator import itemgetter# %%N, M = map(int, readline().split())m = map(int, read().split())LR = zip(m, m)# %%def solve(N, M, LR):blocks = []for L, R in LR:L1, R1 = M - 1 - R, M - 1 - Lif L < L1:blocks.append((L, R))else:blocks.append((L1, R1))blocks.sort(key=itemgetter(0))A = np.zeros(M, np.int64)for L, R in blocks:if A[L: R + 1].any():A = A[::-1]if A[L: R + 1].any():return FalseA[L: R + 1] = 1return True# %%print('YES' if solve(N, M, LR) else 'NO')