#P8984. [北大集训 2021] 末日魔法少女计划

    ID: 9522 远端评测题 2000ms 512MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>动态规划 DP2021Special Judge分治构造

[北大集训 2021] 末日魔法少女计划

Background

CTT2021 D1T1

Problem Description

For given n,kn,k, you need to construct a matrix Ai,jA_{i,j} that contains only 0,10,1, where 0i,jn0\le i,j\le n, satisfying:

  1. Ai,i=1A_{i,i}=1.
  2. Ai,i+1=1A_{i,i+1}=1.
  3. For i>ji>j, Ai,j=0A_{i,j}=0.
  4. If Ai,j=1A_{i,j}=1 and ji>1j-i>1, then there exists i<t<ji<t<j such that Ai,t=At,j=1A_{i,t}=A_{t,j}=1.
  5. For iji\le j, (Ak)i,j>0(A^k)_{i,j}>0.

You need to output every (i,j)(i,j) such that Ai,j=1A_{i,j}=1 and ji>1j-i>1. Let the number of such pairs be mm.

If your output does not meet the requirements, you will get no score for that test point. If your output meets the requirements, then you will be scored based on mm.

Input Format

One line with two integers n,kn,k.

Output Format

The first line contains an integer mm. The next mm lines each contain two integers i,ji,j, which represent each pair (i,j)(i,j) satisfying Ai,j=1A_{i,j}=1 and ji>1j-i>1.

3 2
1
0 2

Hint

  • 1900n20001900\le n\le 2000.
  • 2k152\le k\le 15.
kk f(k)f(k) s(k)s(k)
22 7.98707.9870 2222
33 3.80853.8085 1414
44 2.39602.3960 1111
55 1.96101.9610 99
66 1.60651.6065 77
77 1.45151.4515 66
88 1.25401.2540 55
99 1.19801.1980 55
1010 1.09951.0995 44
1111 1.07051.0705 44
1212 1.03451.0345 44
1313 1.01201.0120 33
1414 1.00151.0015 33
1515 0.99400.9940 33

Each 2k152\le k\le 15 corresponds to a subtask with total score s(k)s(k). The score of each subtask is the minimum score among all test points in that subtask.

The score of each test point equals the total score of its subtask multiplied by $\max\left(0,1-\sqrt{\max\left(0,\frac{m}{n\cdot f(k)}-1\right)}\right)$.

Translated by ChatGPT 5