Logo
(追記) (追記ここまで)

25236번 - Triangular Logs 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
12 초 (추가 시간 없음) 1024 MB209614833.803%

문제

The local forest has a lot of trees! Each tree is located at integer coordinates and has an integer height. Cutting down any tree gives you a log with a length equal to its height. You want to obtain three triangular logs (that is, three logs that form a non-degenerate triangle) by cutting down three trees.

Given a list of queries which each specify an axis-aligned rectangular region, can you obtain three triangular logs by cutting down three trees in that region, possibly including those on the boundary of the rectangle?

입력

The first line of input contains two integers $n$ and $q$ (1ドル \le n,q \le 10^5$), where $n$ is the number of trees and $q$ is the number of queries.

Each of the next $n$ lines contains three integers $x,ドル $y$ and $h$ (1ドル \le x,y,h \le 10^9$), which describes a tree at location ($x,y$) with height $h$. All tree locations are distinct.

Each of the next $q$ lines contains four integers $x_{low},ドル $y_{low},ドル $x_{high}$ and $y_{high}$ (1ドル \le x_{low} \le x_{high} \le 10^9,ドル 1ドル \le y_{low} \le y_{high} \le 10^9$), describing an axis-aligned rectangular region for a query.

출력

Output $q$ lines. Each line contains a single integer, which is the answer to the given query. Output 1 if there are three trees in the queried region that can form a non-degenerate triangle, and 0 otherwise. Output answers to the queries in the order of the input.

제한

예제 입력 1

9 5
1 3 3
2 3 1
3 3 4
1 2 1
2 2 5
3 2 9
1 1 2
2 1 6
3 1 5
1 1 1 2
1 1 2 2
1 1 1 3
1 2 3 2
1 1 3 3

예제 출력 1

0
1
0
0
1

힌트

출처

ICPC > Regionals > North America > North America Championship > North America Championship 2022 L번

Camp > Petrozavodsk Programming Camp > Summer 2022 > Day 1: Welcome Contest L번

  • 문제를 만든 사람: Bowen Yu
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /