/* author: kyawa */ #include using namespace std; int main(){ int64_t N, M; cin >> N >> M; vector> cloud(N); vector> duolc(M); for(auto &[L, R] : cloud){ cin >> L >> R; L *= 2; R *= 2; } for(auto &[L, R] : duolc){ cin >> L >> R; L *= 2; R *= 2; } int64_t K; cin >> K; vector P(K); for(auto &p : P){ cin >> p; p *= 2; } vector res(K, 0); //同じ方向の雲同士で重複がある場合 sort(cloud.begin(), cloud.end()); sort(duolc.begin(), duolc.end()); for(int64_t i = 0; i < N-1; i++){ auto [l1, r1] = cloud[i]; auto [l2, r2] = cloud[i+1]; if(l1 == l2 or l2 <= r1){ for(int64_t i = 0; i < K-1; i++) cout << 1 << " "; cout << 1 << '\n'; return 0; } } for(int64_t i = 0; i < M-1; i++){ auto [l1, r1] = duolc[i]; auto [l2, r2] = duolc[i+1]; if(l1 == l2 or l2 <= r1){ for(int64_t i = 0; i < K-1; i++) cout << 1 << " "; cout << 1 << '\n'; return 0; } } vector CL, CR; for(auto [L, R] : cloud){ CL.push_back(L/2); CR.push_back(R/2); } for(auto [L, R] : duolc){ for(int64_t i = 0; i < K; i++){ int64_t borderR = upper_bound(CL.begin(), CL.end(), P[i] - L/2) - CL.begin(); int64_t borderL = lower_bound(CR.begin(), CR.end(), P[i] - R/2) - CR.begin(); if(borderL < borderR) res[i] = 1; } } for(int64_t i = 0; i < K-1; i++) cout << res[i] << " "; cout << res.back() << '\n'; }