ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#211239 | #2398. 游戏 | 18112606231 | 20 | 68ms | 1232kb | C++11 | 1008b | 2024-08-10 08:47:52 | 2024-08-10 12:33:41 |
answer
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,m,op,x,l,r,a[1000001];
int read()
{
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9')
{
x = (x << 1) + (x << 3) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
signed main()
{
n=read();
m=read();
while(m--)
{
op=read();
if(op==1)
{
x=read();
l=read();
r=read();
for(int i=l;i<=r;i++)
{
a[i]+=(i-l+1)*x;
}
}
else
{
int ans=0;
l=read();
r=read();
for(int i=l;i<=r;i++)
{
ans+=a[i];
}
printf("%lld\n",ans);
}
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 36ms
memory: 1232kb
input:
10000 10000 2 7160 9968 1 -473 6964 8476 1 -153 5216 7023 2 6352 6868 1 -323 2338 2855 1 415 8414 88...
output:
0 -110345895 -118168581 -43417983 -4860827434 -604843653 -2613457133 -534205626 -89290630 484290874 ...
result:
ok 5015 lines
Test #2:
score: 10
Accepted
time: 32ms
memory: 1228kb
input:
10000 10000 1 326 2291 8264 2 2344 3512 1 146 4506 4804 1 342 1373 4495 1 -267 929 3525 1 444 3384 8...
output:
243137972 7529843014 0 11315350608 10741570136 -23729193 8497340876 11134190564 4752384896 166579811...
result:
ok 5048 lines
Test #3:
score: 0
Time Limit Exceeded
input:
666666 10000 1 92 555251 586462 1 393 28541 523118 1 448 17256 369367 1 -28 89257 596132 1 -338 3136...
output:
result:
Test #4:
score: 0
Time Limit Exceeded
input:
666666 50000 1 -249 309981 333889 1 477 309512 463171 1 0 71655 592642 1 45 191249 527454 1 55 38872...
output:
result:
Test #5:
score: 0
Time Limit Exceeded
input:
666666 100000 1 -183 598736 630118 1 -337 605875 639236 1 -62 265069 340682 1 -96 370300 571646 1 -1...
output:
result:
Test #6:
score: 0
Time Limit Exceeded
input:
666666 100000 2 121929 379928 2 34550 66844 1 96 338911 637923 2 161666 370147 1 -282 313713 463127 ...
output:
0 0 46837507488 -2144565871356 12891851830 8888329560532 3600670974792 5838384797676 5198143259786 3...
result:
Test #7:
score: 0
Time Limit Exceeded
input:
750000 100000 1 -318 454211 721481 2 239247 294171 2 52513 339575 2 424462 638364 2 683282 740790 1 ...
output:
0 0 -5392147899330 -3014688113400 -1060371486324 -3974117952270 273653038350 -222431173482 371388923...
result:
Test #8:
score: 0
Time Limit Exceeded
input:
1000000 100000 1 -108 318728 708230 1 -242 8738 411540 1 -119 458000 972357 2 368015 850304 1 -182 1...
output:
-21232196185685 -20910538239000 -3733012342070 -66375750961180 -16926598739637 -12520509636427 -5091...
result:
Test #9:
score: 0
Time Limit Exceeded
input:
1000000 100000 2 347033 984386 2 277881 323793 1 431 735974 973576 2 782909 863840 1 -22 379088 6406...
output:
0 0 3048712203338 -275350879342 2861261347158 10963743541855 980271778300 5329951205134 712899593630...
result:
Test #10:
score: 0
Time Limit Exceeded
input:
1000000 100000 1 -238 406279 814973 1 -425 637451 721356 1 237 340114 658854 2 279214 591961 2 17862...
output:
3413253435344 4249749642085 3270374154195 -7408047958251 0 23029818546288 18074770628646 28102134374...