No.655 E869120 and Good Triangles
問題文最終更新日: 2026-06-26 06:07:39
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 184
(順位表)
の他の問題:
Problem Statement
E869120 saw a triangular figure like the one below.
In this case, the size of the triangular figure is 4.
Now, there is a triangular figure of size $N$. It has $N*(N+1)/2$ vertices in total, and $K$ of them are painted black.
Define the value $a_{i,j}$ as follows.
- $a_{i,j}$ = the length of the shortest path from cell $(i, j)$ to the nearest black vertex (every edge has length 1)
E869120 is going to take a "partial equilateral triangle" out of the triangular figure. A "partial equilateral triangle" is something like the first and second figures from the left in the image below. An inverted triangle like the third figure from the left is not counted.
A choice is called a "good choice" if the sum of $a_{i,j}$ over the vertices contained in the "partial equilateral triangle" is at least $P$. How many good choices are there?
Input
$N$ $K$ $P$ $x_1$ $y_1$ ・・・・ $x_K$ $y_K$
- $1≦N, K≦4000$
- $1≦y_i≦x_i≦N$
- $0≦P≦10^{18}$
Output
Output the number of "good choices" on one line. Do not forget the trailing newline.
Sample
Sample 1
Input
3 1 6 2 1
Output
1
Sample 2
Input
4 1 4 2 2
Output
8
Sample 3
Input
5 2 8 3 2 4 4
Output
5
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
e869120
WA_TLE