結果
問題 | No.2687 所により大雨 |
ユーザー |
![]() |
提出日時 | 2024-03-20 21:46:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,420 bytes |
コンパイル時間 | 2,265 ms |
コンパイル使用メモリ | 203,560 KB |
最終ジャッジ日時 | 2025-02-20 08:57:46 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 WA * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int N, M;cin >> N >> M;vector<pair<long long, long long>> LR(N + M);for (int i = 0; i < N + M; i++){cin >> LR[i].first >> LR[i].second;}int K;cin >> K;vector<long long> P(K);for (int i = 0; i < K; i++){cin >> P[i];}sort(LR.begin(), LR.begin() + N);sort(LR.begin() + N, LR.end());bool ok = false;for (int i = 0; i < N - 1; i++){if (LR[i].second >= LR[i + 1].first){ok = true;}}for (int i = N; i < N + M - 1; i++){if (LR[i].second >= LR[i + 1].first){ok = false;}}if (ok){for (int i = 0; i < K; i++){cout << 1;if (i < K - 1){cout << ' ';}}cout << endl;} else {vector<long long> L(N + M), R(N + M);for (int i = 0; i < N + M; i++){L[i] = LR[i].first;R[i] = LR[i].second;}for (int i = 0; i < K; i++){int E = 0;for (int j = N; j < N + M; j++){long long l = 2 * P[i] - R[j];long long r = 2 * P[i] - L[j];int p = lower_bound(L.begin(), L.begin() + N, l) - L.begin();if (p < N){if (L[p] <= r){E = 1;}}if (p > 0){if (l <= R[p - 1]){E = 1;}}}cout << E;if (i < K - 1){cout << ' ';}}cout << endl;}}