#include<bits/stdc++.h>
using namespace std;
int n,m,a[1000001],k,c,x,y,l,r;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=m;i++){
		cin>>c;int v=0;
		if(c==1){
			cin>>x>>y;
			a[x]+=y;
		}
		if(c==2){
		cin>>l>>r>>k; 
		for(int j=l;j<=r;j++)v+=pow((a[j]+k),3);
		cout<<v<<endl;	
	}
}
	return 0;
} 
测试点 #1
Accepted
得分:100
用时:2 ms
内存:304 KiB

输入文件(test1.in

10 10
45 68 33 53 24 9 75 95 66 75 
1 8 28
2 3 3 -160
2 1 6 96
2 2 2 -54
1 9 3
2 2 10 -84
2 1 1 -109
2 5 5 -59
1 7 -15
<12 bytes omitted>
输出文件(test1.out
-2048383
15554428
2744
-749927
-262144
-42875
选手输出
-2048383
15554428
2744
-749927
-262144
-42875

测试点 #2
Accepted
得分:100
用时:2 ms
内存:228 KiB

输入文件(test2.in

20 20
89 66 56 22 15 93 93 26 49 6 33 60 49 28 41 13 23 96 94 93 
2 12 14 -74
1 1 -55
2 10 13 -112
1 20 37
1 7 41
2 17 18
<144 bytes omitted>
输出文件(test2.out
-115705
-2074710
-5270813
2524968
选手输出
-115705
-2074710
-5270813
2524968

测试点 #3
Accepted
得分:100
用时:2 ms
内存:228 KiB

输入文件(test3.in

100 100
7 100 21 61 3 64 4 21 50 61 86 48 54 96 5 61 50 18 9 94 56 8 82 98 93 46 35 46 70 32 28 74 5 13 62 41 40 23 1 4 49 12 3
<1307 bytes omitted>
输出文件(test3.out
-4794606
-950976
7486629
82508582
-698990
295756
301158527
116808715
722719916
290244174
-1030301
325964439
-9943946
<437 bytes omitted>
选手输出
-4794606
-950976
7486629
82508582
-698990
295756
301158527
116808715
722719916
290244174
-1030301
325964439
-9943946
51198003
11
<381 bytes omitted>

测试点 #4
Time Limit Exceeded
得分:0
用时:2144 ms
内存:624 KiB

输入文件(test4.in

80000 80000
63 71 55 47 22 44 5 20 67 86 8 42 40 87 47 46 17 91 61 17 53 10 37 71 84 27 44 30 9 27 53 73 2 41 63 97 49 20 77 64
<1482354 bytes omitted>
输出文件(test4.out
3369687422
-472807902
34271331503
-8280285
-65239950940
-2831709411
-50243482916
2722212378
1558289757
2697519867
2097
<530439 bytes omitted>
选手输出
-926673490
-472807902
-93223263
-8280285
-2147483648
-2147483648
-2147483648
-1573607741
1558289757
-1597450293
-505168389
-2050
<17803 bytes omitted>

测试点 #5
Time Limit Exceeded
得分:0
用时:2132 ms
内存:696 KiB

输入文件(test5.in

100000 100000
52 42 1 96 100 100 15 84 32 40 85 4 62 86 65 52 95 76 47 22 18 51 49 96 31 44 97 58 70 59 9 38 17 96 55 49 47 65 
<1857441 bytes omitted>
输出文件(test5.out
-167958546000
-64249081711
9432964971
331385444894
24261797468
-27774378042
281504856041
-5688475
1928320255
1744648558
<665138 bytes omitted>
选手输出
-2147483648
-2147483648
842221687
256856783
-1510561894
-2147483648
1680261554
-5688475
1928320255
1744648558
383990448
81557325
<14206 bytes omitted>

测试点 #6
Time Limit Exceeded
得分:0
用时:2115 ms
内存:1088 KiB

输入文件(test6.in

200000 200000
34 78 56 47 7 18 57 73 60 39 74 64 63 16 96 87 54 91 33 55 23 77 63 15 56 23 65 15 52 76 62 46 51 97 18 74 90 71 
<3859916 bytes omitted>
输出文件(test6.out
223171353083
-7670275270
24845442838
3949879004
1160725221
494366902294
216526859664
-67637506
-1669704491
-1542052788
<1362717 bytes omitted>
选手输出
-466193218
-2147483648
-926327364
-345223023
1160725221
31863170
1595778844
-67637506
-1669704491
-1542052788
-932519880
-645954
<6559 bytes omitted>

测试点 #7
Time Limit Exceeded
得分:0
用时:2103 ms
内存:2172 KiB

输入文件(test7.in

500000 500000
87 20 55 36 3 13 39 32 2 44 9 68 52 59 88 8 5 75 13 8 44 97 70 48 54 39 4 27 40 72 24 70 29 58 86 88 11 91 50 1 6
<9926495 bytes omitted>
输出文件(test7.out
-38855170
-99337920058
-100985903653
-12724515994
3675132898
657180312928
-4681298204
13937463432
43123714
29618261362
<3508888 bytes omitted>
选手输出
-38855170
-2147483648
-2147483648
-2147483648
-619899277
-755964117
-2147482648
1052255259
43123714
-448337137
-2147483648
-2147
<2368 bytes omitted>

测试点 #8
Time Limit Exceeded
得分:0
用时:2140 ms
内存:3348 KiB

输入文件(test8.in

800000 800000
92 10 64 5 27 21 57 90 2 70 13 71 15 31 100 63 77 49 20 30 31 76 81 55 29 71 80 99 59 48 19 91 85 77 79 64 7 57 7
<16020010 bytes omitted>
输出文件(test8.out
-212198148308
607962686687
325324899721
-1513245568214
1118038909736
237655450524
20074482499
512554781382
-114599164146
<5694542 bytes omitted>
选手输出
-2147483648
2147449504
-1215105836
-2147483648
709679104
1070592469
-1402193926
1328886694
-2147483648
1297135139
1323066324
-21
<1389 bytes omitted>

测试点 #9
Time Limit Exceeded
得分:0
用时:2111 ms
内存:4108 KiB

输入文件(test9.in

1000000 1000000
88 80 19 57 94 60 78 30 93 13 15 22 14 35 24 85 95 87 42 25 23 63 39 40 33 2 68 20 88 86 63 20 68 68 36 64 1 19
<20086771 bytes omitted>
输出文件(test9.out
-744885648
-16486378982
4019798418277
-8453184700
256987073969
4300956748318
384818656450
-876275026828
218045107382
11
<7167303 bytes omitted>
选手输出
-744885648
-2147483648
-860362002
-2147483648
-827468995
-294982574
-2134643528
-2147483648
-1125188198
161751935
2037573107
194
<1243 bytes omitted>

测试点 #10
Time Limit Exceeded
得分:0
用时:2133 ms
内存:4092 KiB

输入文件(test10.in

1000000 1000000
93 42 72 31 97 13 57 35 6 29 53 90 49 90 65 84 78 42 31 92 76 100 75 4 3 82 50 40 81 48 65 18 80 3 50 88 55 54 
<20086152 bytes omitted>
输出文件(test10.out
-823777838590
-12158100028
634644823433
-4382653856
2008798828505
-5581267272
1071395647099
-72875894961
-16656490391
-
<7165786 bytes omitted>
选手输出
-2147483648
-2147483648
-1269911665
-2147483648
1750914883
-2147483648
520027835
-2147483648
-2147483648
-2147483648
357195271
5
<1262 bytes omitted>