QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#749488#7495. 世上最幸福的女孩TheZone0 0ms0kbC++171.3kb2024-11-15 01:33:122024-11-15 01:33:13

Judging History

你现在查看的是最新测评结果

  • [2024-11-15 01:33:13]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-11-15 01:33:12]
  • 提交

answer

#include<stdio.h>
#define MAX 600000
void l1(int n);
int l2(int left,int right);
int a[MAX];
int main(){
    int n,m,k;
    scanf("%d%d",&n,&m);
    int l[n];
    for(int i=0;i<n;i++){
		scanf("%d",&l[i]);
	}
	for(int i=0;i<m;i++){
		scanf("%d",&k);
		if(k==1){
			int c;
			scanf("%d",&c);
			l1(c);
		}else{
			int d,e;
			scanf("%d%d",&d,&e);
			for(int i=0;i<MAX;i++){
				printf("%d\n",l2(d,e));
			}
		}
	}
    return 0;
}
void l1(int n){
	for(int i=0;i<MAX;i++){
		a[i]+=n;
	}
}
int l2(int left,int right)
{
    int center,i,sum,left_sum,right_sum,left_max,right_max;
    center=(left+right)>>1;
    if(left==right)
        return a[left]>0?a[left]:0;
    else
    {
        left_sum=l2(left,center);
        right_sum=l2(center+1,right);
        sum=0;
        left_max=0;
        for(i=center;i>=left;i--)
        {
            sum+=a[i];
            if(sum>left_max)
                left_max=sum;
        }
        sum=0;
        right_max=0;
        for(i=center+1;i<=right;i++)
        {
            sum+=a[i];
            if(sum>right_max)
                right_max=sum;
        }
        sum=right_max+left_max;
        if(sum<left_sum)
            sum=left_sum;
        if(sum<right_sum)
            sum=right_sum;
    }
    return sum;
}

详细


Pretests


Final Tests

Test #1:

score: 0
Time Limit Exceeded

input:

300000 600000
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74...

output:

1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
1536778517
153...

result:


Test #2:

score: 0
Time Limit Exceeded

input:

300000 600000
-6000 -12000 -18000 -24000 -30000 -36000 -42000 -48000 -54000 -60000 -66000 -72000 -78000 -84000 -90000 -96000 -102000 -108000 -114000 -120000 -126000 -132000 -138000 -144000 -150000 -156000 -162000 -168000 -174000 -180000 -186000 -192000 -198000 -204000 -210000 -216000 -222000 -228000...

output:


result:


Test #3:

score: 0
Time Limit Exceeded

input:

300000 600000
694739332 12000 18000 24000 30000 36000 42000 48000 54000 60000 66000 72000 78000 84000 90000 96000 102000 108000 114000 120000 126000 132000 138000 805133449 150000 156000 162000 168000 174000 180000 186000 192000 198000 204000 210000 216000 222000 372033439 234000 240000 246000 25200...

output:


result:


Test #4:

score: 0
Time Limit Exceeded

input:

300000 600000
-370584886 -824446876 -217953152 -213883201 -3695086 -244661761 -31643401 -28513584 -120242422 -164834515 -442171367 -44150185 -373313047 -176037889 -88006209 13397 -137034887 -288429275 -105994131 9344897 -561275521 -739928113 -410398492 -766560640 -234474561 -376898910 -3876489 -7672...

output:

247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
247007085
...

result:


Test #5:

score: 0
Time Limit Exceeded

input:

300000 600000
211880591 88968133 407526653 911890111 807256887 -176021101 106280356 8936401 282861019 5357877 254177 417572162 -357964741 -381515641 129902155 473664349 -59617567 667379417 776235315 58916209 7886485 223802672 -47045571 804252695 203831125 43372991 28892923 158908981 378392554 -30512...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:


Test #6:

score: 0
Time Limit Exceeded

input:

300000 600000
478547749 21607029 -89838541 489455731 -26326441 -57796177 11291418 580134112 194452929 323639427 78318073 26812402 543586369 370325145 -15025771 77970751 -57165081 69553200 68373559 103525821 488338363 -114852353 129257857 353303549 120029521 55251574 184069369 116347321 66298177 2323...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:


Test #7:

score: 0
Time Limit Exceeded

input:

300000 600000
-167628 147836 342193 -113005 335767 62551 37153 391126 62081 394393 64376 61561 204691 362478 -192721 246628 -34842 558316 210421 492772 63566 -119326 208751 549977 400921 424726 242537 401281 -156335 392551 175009 213401 277477 510111 27205 90706 544489 166673 325195 362819 -1502 497...

output:


result:


Test #8:

score: 0
Time Limit Exceeded

input:

300000 600000
-52710799 -139860657 -76037377 -383460841 -250485933 -170800931 38569417 -148104385 -366126471 36758571 61991329 -179464171 -336298825 -58594900 22133163 -423137793 -364236327 37740025 -191822446 -86831549 68026423 -113477261 -80044118 -45362365 -154807957 -29767662 -474689591 -1954812...

output:


result:


Test #9:

score: 0
Time Limit Exceeded

input:

300000 600000
-9317 -17721 83807 -89601 -132992 -21217 -164947 -15601 -168899 190720 -33799 -114351 -91457 -194029 132053 -109571 -65991 -107846 -77121 -90550 -162626 -66021 -52064 -69881 55395 -187207 -41697 -152345 76528 -97151 -172721 100673 -190401 -29409 -62929 -112268 -92705 -165993 -61056 -37...

output:


result:


Test #10:

score: 0
Time Limit Exceeded

input:

300000 600000
-9317 -17721 83807 -89601 -132992 -21217 -164947 -15601 -168899 190720 -33799 -114351 -91457 -194029 132053 -109571 -65991 -107846 -77121 -90550 -162626 -66021 -52064 -69881 55395 -187207 -41697 -152345 76528 -97151 -172721 100673 -190401 -29409 -62929 -112268 -92705 -165993 -61056 -37...

output:


result:


Test #11:

score: 0
Time Limit Exceeded

input:

300000 600000
-350031 -418621 -379153 -349541 -204935 -413677 -290785 -73634 -339579 -86194 -237211 -393502 -477091 -479966 -452057 -384481 -843294 -221408 -132345 -109333 -149097 -483897 -29033 -220275 -50099 -39225 -148729 -397731 -222829 -436818 -233585 -433945 -335641 -44285 -107328 -338151 -534...

output:

224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044
224044...

result:


Test #12:

score: 0
Time Limit Exceeded

input:

300000 600000
-696987827 1791548840 1540245114 -744556712 281332436 -396365348 -660700017 -926408705 66098449 1448486061 -1945919603 1080362360 732219815 -519568302 1228792006 364734706 -1151351486 -1056003603 -1852483513 -1758573146 762059937 -333873273 -1645890512 1388909837 -267565502 1028489524 ...

output:


result: