#P4593. [TJOI2018] 教科书般的亵渎

    ID: 3532 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>模拟递推2018各省省选天津差分

[TJOI2018] 教科书般的亵渎

Description

Xiao Dou likes playing games. He is now facing a situation in a game where each monster has health aia_i, and all monsters have distinct health values. Xiao Dou has an unlimited number of "Defile" cards. The effect of Defile is to deal 11 damage to all monsters; if any monster dies, the spell is cast again. We consider a monster to be dead when its health reaches 00.

Each time Xiao Dou uses one "Defile," he gets some score. The score is calculated as follows: after using a single "Defile," every monster that is damaged by "Defile" grants Xiao Dou xkx^k points, where xx is that monster’s health value before the damage is applied, and kk is the number of "Defile" cards needed to kill all monsters. Note: automatic re-casts of "Defile" caused by monster deaths do not count toward kk, and they do not increase Xiao Dou’s score.

Input Format

The first line contains an integer TT (T10T \le 10), the number of test cases.

For each test case, the first line contains nn, mm, where nn is the maximum health value among the monsters, and mm is the number of health values that are missing.

The next mm lines each contain one number aia_i, indicating that there is no monster with health aia_i on the field.

Output Format

Output TT lines. The ii-th line contains the final score Xiao Dou can obtain in the ii-th test case, modulo 109+710^9+7.

2
10 1
5
4 2
1
2
415
135

Hint

  • For 10%10\% of the testdata, m=0m=0.
  • For 20%20\% of the testdata, m1m \le 1.
  • For 30%30\% of the testdata, m2m \le 2.
  • For 40%40\% of the testdata, m3m \le 3.
  • For 50%50\% of the testdata, m4m \le 4.
  • For 60%60\% of the testdata, m5m \le 5.
  • For 100%100\% of the testdata, m50m \le 50, n1013n \le 10^{13}, 1ai<n1 \le a_i < n.

Translated by ChatGPT 5