結果
問題 | No.274 The Wall |
ユーザー |
![]() |
提出日時 | 2015-10-01 20:05:01 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 693 bytes |
コンパイル時間 | 1,201 ms |
コンパイル使用メモリ | 164,856 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 02:06:49 |
合計ジャッジ時間 | 1,938 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#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;}