結果
問題 |
No.2687 所により大雨
|
ユーザー |
![]() |
提出日時 | 2024-03-20 21:51:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,383 bytes |
コンパイル時間 | 2,600 ms |
コンパイル使用メモリ | 203,124 KB |
最終ジャッジ日時 | 2025-02-20 09:00:36 |
ジャッジサーバー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> X(N * 2); for (int i = 0; i < N; i++){ X[i * 2] = LR[i].first; X[i * 2 + 1] = 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] - LR[j].second; long long r = 2 * P[i] - LR[j].first; int pl = lower_bound(X.begin(), X.end(), l) - X.begin(); int pr = upper_bound(X.begin(), X.end(), r) - X.begin(); if (!(pl == pr && pl % 2 == 0)){ E = 1; } } cout << E; if (i < K - 1){ cout << ' '; } } cout << endl; } }