結果
問題 |
No.274 The Wall
|
ユーザー |
![]() |
提出日時 | 2015-10-01 20:04:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 692 bytes |
コンパイル時間 | 1,389 ms |
コンパイル使用メモリ | 165,620 KB |
実行使用メモリ | 16,960 KB |
最終ジャッジ日時 | 2024-07-19 18:55:37 |
合計ジャッジ時間 | 8,082 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | TLE * 1 -- * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que; for (int i = 0; i < n; ++i) { int l, r; cin >> l >> r; if (l > m - r - 1) que.push(make_pair(m - r - 1, m - l - 1)); else que.push(make_pair(l, r)); } int t = -1; while (!que.empty()) { auto now = que.top(); que.pop(); if (t >= now.first) { if (now.first > m - now.second - 1) { cout << "NO" << endl; return 0; } que.push(make_pair(m - now.second - 1, m - now.first - 1)); } else { t = now.second; } } cout << "YES" << endl; }