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

15433번 - Umbral Decoding 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB153312720.455%

문제

You are planning a clever attack against a new encryption algorithm. To succeed, you need to find the key, which is a pair of integers (p, q). We can think of the key as a point on a two-dimensional integer lattice whose location is unknown. However, you know that (p, q) lies in the square spanned by the lattice points (0, 0) and (n, n) for a given n, i.e. 0 ≤ p, q ≤ n.

Your attack has three stages:

Identify safe points and their bounds.
Eliminate as key candidates those points that lie in the “umbra” of any safe point.
Test the remaining points to see which one is the key.

Stage 1 has already been performed and you are given several safe points of the form (x, y, b) as input.

In Stage 2 you eliminate a point (p, q) if it lies in the umbra of any safe point. Point (p, q) is in the umbra of safe point (x, y, b) if and only if

|x − p|3 + |y − q|3 ≤ b.

Your task in this problem is to count how many points will be left for testing in Stage 3 so that we have an estimate of the amount of work left to complete the attack.

Figure M.1: Sample input safe points and umbra (red) and remaining points (blue).

입력

Input begins with two integers n, k on a single line, separated by a space, with 2 ≤ n ≤ 100 000 000, and 0 ≤ k ≤ 100. Following that are k lines each containing three integers x, y, b separated by spaces, representing the safe points. The values of x and y are both in the range [0, n]. The bound b lies in the range [0, n].

출력

Output the number of points (p, q), with 0 ≤ p, q ≤ n, that do not lie in the umbra of any safe point.

제한

예제 입력 1

4 1
2 2 2

예제 출력 1

16

예제 입력 2

30 2
20 20 30
25 22 30

예제 출력 2

891

힌트

출처

ICPC > Regionals > North America > North America Qualification Contest > ACM-ICPC North America Qualifier 2017 M번

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

출처

대학교 대회

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

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