結果

問題 No.274 The Wall
ユーザー h_noson
提出日時 2016-03-24 22:32:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 689 bytes
コンパイル時間 700 ms
コンパイル使用メモリ 65,008 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-17 18:50:42
合計ジャッジ時間 1,670 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 100000000

typedef long long ll;

int main() {
    int i, n, m;
    int a[4001] {};
    bool ans;
    cin >> n >> m;
    rep (i,n) {
        int l, r;
        cin >> l >> r;
        a[l]++; a[r+1]--;
    }
    rep (i,m) a[i+1] += a[i];
    ans = true;
    rep (i,m) {
        if (a[i] > 2 || a[i] == 2 && a[m-i-1] != 0)
            ans = false;
    }
    if (ans)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}
0