結果

問題 No.274 The Wall
ユーザー finefine
提出日時 2016-04-03 00:27:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 954 bytes
コンパイル時間 1,396 ms
コンパイル使用メモリ 161,064 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 10:40:34
合計ジャッジ時間 2,574 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, l, r;
    bool f;
    string ans = "YES";
    cin >> n >> m;
    vector<int> a(m,0);
    for(int i = 0; i < n; i++) {
        cin >> l >> r;
        f = true;
        for(int j = l; j <= r; j++) {
            if(a[j]) {
                f = false;
                break;
            }
        }
        if (f) {
            for(int j = l; j <= r; j++) a[j] = 1;
        } else {
            l = m - 1 - l;
            r = m - 1 - r;
            f = true;
            for(int j = r; j <= l; j++) {
                if(a[j]) {
                    f = false;
                    break;
                }
            }
            if (f) {
                for(int j = r; j <= l; j++) a[j] = 1;
            } else {
                ans = "NO";
                break;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}
0