結果
問題 | No.274 The Wall |
ユーザー |
![]() |
提出日時 | 2015-08-29 00:20:13 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 977 bytes |
コンパイル時間 | 647 ms |
コンパイル使用メモリ | 87,076 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-22 02:02:14 |
合計ジャッジ時間 | 1,537 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
#include <cstdio>#include <cstring>#include <cmath>#include <climits>#include <iostream>#include <iomanip>#include <list>#include <stack>#include <queue>#include <vector>#include <map>#include <set>#include <string>#include <utility>#include <algorithm>#include <numeric>#include <functional>#define FOR(i,a,b) for (int i=(a);i<(b);i++)#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)#define REP(i,n) for (int i=0;i<(n);i++)#define RREP(i,n) for (int i=(n)-1;i>=0;i--)#define ALL(a) (a).begin(),(a).end()using namespace std;typedef long long ll;int N, M, L, R, center;int dp[4010];int main(int argc, char *argv[]){cin.tie(0);ios::sync_with_stdio(false);cin >> N >> M;REP(i,N) {cin >> L >> R;RFOR(j,L,R+1) dp[j]++;int l2 = M-1-R;int r2 = M-1-L;RFOR(j,l2,r2+1) dp[j]++;}REP(i,M) {if (dp[i] > 2) {cout << "NO" << endl;return 0;}}cout << "YES" << endl;return 0;}