Codeforces Round 185 (Div. 1)
D
Interval Cubing
Codeforces
2600
原题
← CE →
翻译中…

While learning Computational Geometry, Tiny is simultaneously learning a useful data structure called segment tree or interval tree. He has scarcely grasped it when comes out a strange problem:

翻译中…

Given an integer sequence $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. You should run $*q*$ queries of two types:

翻译中…
  1. Given two integers $*l*$ and $*r*$ ($1 ≤ *l* ≤ *r* ≤ *n*$), ask the sum of all elements in the sequence $*a*_{*l*}, *a*_{*l* + 1}, ..., *a*_{*r*}$.
  2. Given two integers $*l*$ and $*r*$ ($1 ≤ *l* ≤ *r* ≤ *n*$), let each element $*x*$ in the sequence $*a*_{*l*}, *a*_{*l* + 1}, ..., *a*_{*r*}$ becomes $*x*^{3}$. In other words, apply an assignments $*a*_{*l*} = *a*_{*l*}^{3}, *a*_{*l* + 1} = *a*_{*l* + 1}^{3}, ..., *a*_{*r*} = *a*_{*r*}^{3}$.
翻译中…

For every query of type 1, output the answer to it.

翻译中…

Tiny himself surely cannot work it out, so he asks you for help. In addition, Tiny is a prime lover. He tells you that because the answer may be too huge, you should only output it modulo $95542721$ (this number is a prime number).

翻译中…

Input

翻译中…

The first line contains an integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$), representing the length of the sequence. The second line contains $*n*$ space-separated integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($0 ≤ *a*_{*i*} ≤ 10^{9}$).

翻译中…

The third line contains an integer $*q*$ ($1 ≤ *q* ≤ 10^{5}$), representing the number of queries. Then follow $*q*$ lines. Each line contains three integers $*t*_{*i*}$ ($1 ≤ *t*_{*i*} ≤ 2$), $*l*_{*i*}$, $*r*_{*i*}$ ($1 ≤ *l*_{*i*} ≤ *r*_{*i*} ≤ *n*$), where $*t*_{*i*}$ stands for the type of the query while $*l*_{*i*}$ and $*r*_{*i*}$ is the parameters of the query, correspondingly.

翻译中…

Output

翻译中…

For each 1-type query, print the answer to it per line.

翻译中…

You should notice that each printed number should be non-negative and less than $95542721$.

翻译中…

样例

Input #1
8
1 2 3 4 5 6 7 8
5
1 2 5
2 2 5
1 2 5
2 3 6
1 4 7
Output #1
14
224
2215492
InputCopy OutputCopy
题目信息
题号
311D
时间限制
6 s
内存限制
256 MB
标签
数据结构
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。