結果

問題 No.2687 所により大雨
ユーザー だれだれ
提出日時 2023-12-16 03:48:00
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,600 bytes
コンパイル時間 1,245 ms
コンパイル使用メモリ 102,756 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-20 06:08:04
合計ジャッジ時間 4,601 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>

using namespace std;
using i64 = int;

const i64 inf = 1e9 + 1000;

template <class T>
void printvec(vector<T>& v) {
    int n = v.size();
    for (int i = 0; i < n; i++) {
        cout << v[i];
        if (i == n - 1)
            cout << "\n";
        else
            cout << " ";
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<i64, i64>> v1(n), v2(m);
    for (int i = 0; i < n; i++) {
        cin >> v1[i].first >> v1[i].second;
    }
    for (int i = 0; i < m; i++) {
        cin >> v2[i].first >> v2[i].second;
    }
    sort(v1.begin(), v1.end());
    sort(v2.begin(), v2.end());

    bool f = false;

    for (int i = 0; i < n - 1; i++) {
        if (v1[i + 1].first <= v1[i].second) {
            f = true;
        }
    }
    for (int i = 0; i < m - 1; i++) {
        if (v2[i + 1].first <= v2[i].second) {
            f = true;
        }
    }

    int k;
    cin >> k;
    vector<i64> p(k);
    for (int i = 0; i < k; i++) cin >> p[i];

    vector<int> ans(k);
    if (f) {
        for (int i = 0; i < k; i++) ans[i] = 1;
        printvec(ans);
        return 0;
    }

    for (int i = 0; i < k; i++) {
        for (int j = 0; j < m; j++) {
            auto [l, r] = v2[j];
            auto x = make_pair(p[i] * 2 - l, inf);
            auto t = upper_bound(v1.begin(), v1.end(), x) - v1.begin();
            if (t == 0) continue;
            if (p[i] * 2 - r <= v1[t - 1].second) {
                ans[i] = 1;
                break;
            }
        }
    }
    printvec(ans);
}
0