結果

問題 No.2687 所により大雨
ユーザー t98slidert98slider
提出日時 2024-03-22 02:58:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,504 bytes
コンパイル時間 2,552 ms
コンパイル使用メモリ 210,168 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-22 02:58:09
合計ジャッジ時間 6,199 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
6,676 KB
testcase_01 AC 33 ms
6,676 KB
testcase_02 AC 34 ms
6,676 KB
testcase_03 AC 33 ms
6,676 KB
testcase_04 AC 33 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
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 WA -
testcase_25 WA -
testcase_26 AC 5 ms
6,676 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m, k;
    cin >> n >> m;
    vector<pair<ll,ll>> L(n), R(m);
    bool flg = false;
    for(auto &&[l, r] : L){
        cin >> l >> r;
        l *= 2, r *= 2;
        swap(l, r);
    }
    for(auto &&[l, r] : R){
        cin >> l >> r;
        l *= 2, r *= 2;
    }
    sort(L.begin(), L.end());
    sort(R.begin(), R.end());
    for(int i = 0; i + 1 < L.size() && !flg; i++){
        if(L[i + 1].second <= L[i].first) flg = true;
    }
    for(int i = 0; i + 1 < R.size() && !flg; i++){
        if(R[i + 1].first <= R[i].second) flg = true;
    }
    cin >> k;
    if(flg){
        for(int i = 0; i < k; i++) cout << 1 << (i + 1 == k ? '\n' : ' ');
        return 0;
    }
    for(int i = 0; i < k; i++){
        ll v;
        cin >> v;
        v *= 2;
        bool flg = false;
        for(auto [l, r] : R){
            ll l2 = v - (r - v), r2 = v - (l - v);
            if(l2 > r2) swap(l2, r2);
            int li = lower_bound(L.begin(), L.end(), make_pair(l2, -1ll)) - L.begin();
            int ri = lower_bound(L.begin(), L.end(), make_pair(r2, -1ll)) - L.begin();
            if(li != ri || (li < n && L[li].second <= l2 && l2 <= L[li].first) 
            || (ri < n && L[ri].second <= r2 && r2 <= L[ri].first)){
                flg = true;
                break;
            }
        }
        cout << (flg ? 1 : 0) << (i + 1 == k ? '\n' : ' ');
    }
}
0