結果
問題 | No.274 The Wall |
ユーザー |
![]() |
提出日時 | 2016-05-07 15:42:51 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,216 bytes |
コンパイル時間 | 1,420 ms |
コンパイル使用メモリ | 165,732 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 10:19:43 |
合計ジャッジ時間 | 1,931 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 WA * 10 |
ソースコード
#include <bits/stdc++.h>typedef long long ll;typedef unsigned long long ull;#define FOR(i,a,b) for(int (i)=(a);i<(b);i++)#define REP(i,n) FOR(i,0,n)#define RANGE(vec) (vec).begin(),(vec).end()using namespace std;bool rangeIsCross(int s1, int e1, int s2, int e2){return max(s1,s2) <= min(e1,e2);}class TheWall{public:void solve(void){int N,M;cin>>N>>M;set<pair<int,int>> S;REP(i,N){int l,r;cin>>l>>r;S.emplace(l,r);}int l = M;int r = -1;while (!S.empty()){int l1,r1;tie(l1,r1) = *S.begin();S.erase(S.begin());if ( rangeIsCross(-1,r,l1,r1) ){if ( rangeIsCross(M-1-r1,M-1-l1,l,M) ){cout<<"NO"<<endl;return;}l = M-1-r1;}r = r1;}cout<<"YES"<<endl;}};#if 1int main(int argc, char *argv[]){ios::sync_with_stdio(false);auto obj = new TheWall();obj->solve();delete obj;return 0;}#endif