結果
| 問題 |
No.1557 Binary Variable
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-30 10:40:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 523 ms / 2,000 ms |
| コード長 | 267 bytes |
| コンパイル時間 | 998 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 92,668 KB |
| 最終ジャッジ日時 | 2024-12-30 10:41:18 |
| 合計ジャッジ時間 | 20,587 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
N,M = map(int,input().split())
import heapq
heap = []
for _ in range(M):
l,r = map(int,input().split())
heapq.heappush(heap,(r,l))
cnt = 0
cur = -1
while heap:
r,l = heapq.heappop(heap)
if l<=cur:
continue
cur = r
cnt += 1
print(N-cnt)