CF446E.DZY Loves Bridges
NOI/NOI+/CTSC
通过率:0%
时间限制:5.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
DZY owns 2_m_ islands near his home, numbered from 1 to 2_m_. He loves building bridges to connect the islands. Every bridge he builds takes one day's time to walk across.
DZY has a strange rule of building the bridges. For every pair of islands u, v (u ≠ v), he has built 2_k_ different bridges connecting them, where
(a|b means b is divisible by a). These bridges are bidirectional.
Also, DZY has built some bridges connecting his home with the islands. Specifically, there are a__i different bridges from his home to the i-th island. These are one-way bridges, so after he leaves his home he will never come back.
DZY decides to go to the islands for sightseeing. At first he is at home. He chooses and walks across one of the bridges connecting with his home, and arrives at some island. After that, he will spend t day(s) on the islands. Each day, he can choose to stay and rest, or to walk to another island across the bridge. It is allowed to stay at an island for more than one day. It's also allowed to cross one bridge more than once.
Suppose that right after the t-th day DZY stands at the i-th island. Let ans[i] be the number of ways for DZY to reach the i-th island after t-th day. Your task is to calculate ans[i] for each i modulo 1051131.
DZY 在他家附近拥有 2m 座岛屿,编号从 1 到 2m。他热衷于建造桥梁来连接这些岛屿。每座桥需要花费一天时间才能穿越。
DZY 建造桥梁遵循一条奇特的规则:对任意一对岛屿 u,v(其中 u=v),他建造了 2k 座不同的桥来连接它们,其中

(a∣b 表示 a 整除 b)。这些桥是双向的。
此外,DZY 还建造了一些从他家通往各岛屿的桥。具体而言,从他家到第 i 座岛屿共有 ai 座不同的桥。这些桥为单向桥,因此一旦他离开家,便无法再返回。
DZY 决定前往这些岛屿观光。初始时,他位于家中。他选择并穿越一座连接家与某岛屿的桥,抵达某座岛屿。之后,他将在岛屿上停留 t 天。每天,他可以选择留在当前岛屿休息,或通过一座桥前往另一座岛屿。允许他在同一座岛屿上停留多天,也允许多次穿越同一座桥。
假设在第 t 天结束时,DZY 正好位于第 i 座岛屿上。令 ans[i] 表示 DZY 在第 t 天结束时恰好位于第 i 座岛屿的方案数。你的任务是,对每个 i,计算 ans[i] 对 1051131 取模的结果。
输入格式
To avoid huge input, we use the following way to generate the array a. You are given the first s elements of array: _a_1, a_2, ..., a__s. All the other elements should be calculated by formula: a__i = (101·a__i - s + 10007) mod 1051131 (s < i ≤ 2_m).
The first line contains three integers m, t, s (1 ≤ m ≤ 25; 1 ≤ t ≤ 1018; 1 ≤ s ≤ min(2_m_, 105)).
The second line contains s integers _a_1, _a_2, ..., a__s (1 ≤ a__i ≤ 106).
为避免输入过大,我们采用以下方式生成数组 a。你将得到数组的前 s 个元素:a1,a2,…,as。其余所有元素需按如下公式计算:ai=(101⋅ai−s+10007)mod1051131(其中 s<i≤2m)。
第一行包含三个整数 m,t,s(1≤m≤25;1≤t≤1018;1≤s≤min(2m,105))。
第二行包含 s 个整数 a1,a2,…,as(1≤ai≤106)。
输出格式
To avoid huge output, you only need to output xor-sum of all the answers for all i modulo 1051131 (1 ≤ i ≤ 2_m_), i.e. (ans[1] mod 1051131) xor (ans[2] mod 1051131) xor... xor (ans[n] mod 1051131).
为避免输出过大,你只需输出所有 i(1≤i≤2m)对应的答案的异或和(模 1051131),即
(ans[1]mod1051131)⊕(ans[2]mod1051131)⊕⋯⊕(ans[n]mod1051131).
输入输出样例
输入#1
2 1 4 1 1 1 2
输出#1
1
输入#2
3 5 6 389094 705719 547193 653800 947499 17024
输出#2
556970
说明/提示
In the first sample, ans = [6, 7, 6, 6].
If he wants to be at island 1 after one day, he has 6 different ways:
- home —> 1 -(stay)-> 1
- home —> 2 —> 1
- home —> 3 —> 1
- home —> 3 —> 1 (note that there are two different bridges between 1 and 3)
- home —> 4 —> 1
- home —> 4 —> 1 (note that there are two different bridges from home to 4)
In the second sample, (_a_1, _a_2, _a_3, _a_4, _a_5, _a_6, _a_7, _a_8) = (389094, 705719, 547193, 653800, 947499, 17024, 416654, 861849), ans = [235771, 712729, 433182, 745954, 139255, 935785, 620229, 644335].
在第一个样例中,ans = [6, 7, 6, 6]。
若他希望一天后位于岛屿 1,则共有 6 种不同的路径:
- 家 → 1 →(停留)→ 1
- 家 → 2 → 1
- 家 → 3 → 1
- 家 → 3 → 1(注意:岛屿 1 与 3 之间有两座不同的桥)
- 家 → 4 → 1
- 家 → 4 → 1(注意:从家到岛屿 4 有两座不同的桥)
在第二个样例中,(a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8) = (389094, 705719, 547193, 653800, 947499, 17024, 416654, 861849),ans = [235771, 712729, 433182, 745954, 139255, 935785, 620229, 644335]。
输入解题思路,AI测评打分。不知道怎么写?