UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#213132#584. t3sean138106539ms1584kbC++111.2kb2024-11-09 20:47:042024-11-09 23:18:01

answer

#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e5+5,mod=1e9+7;
int n,m,a[MAXN],type,l,r,x,cf[MAXN],ans;
int qpow(int x,int y) {
	int ret=1;
	while(y) {
		if(y&1) {
			ret=ret*x%mod;
		}
		y>>=1;
		x=x*x%mod;
	}
	return ret;
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        
        cf[i]=a[i]-a[i-1];
        
    }
    
    while(m--){
        scanf("%d%d%d%d",&type,&l,&r,&x);
        if(type==1){
            cf[l]+=x;
            cf[r+1]-=x;
        }else if(type==2){
            int k=0,j=0;
            for(int i=1;i<=l-1;i++){
                k+=cf[i];
            }
            j+=k;
            for(int i=l;i<=r+1;i++){
                j+=cf[i];
            }
            for(int i=l+1;i<=r;i++){
                cf[i]=0;
            }
            cf[l]=x-k;
            cf[r+1]=j-x;
        }else{
            int k=0;ans=0;
            for(int i=1;i<=l-1;i++){
                k+=cf[i];
            }
            for(int i=l;i<=r;i++){
                k+=cf[i];
                ans+=qpow(k,x);
                ans%=mod;
            }
            printf("%d",ans);
        }
    }

    return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 1200kb

input:

458 823
14431 9895 11970 15308 2575 20181 709 27999 12992 18884 11061 16281 5044 28990 25092 28337 3...

output:

-790087949-106824567396346066683669935-874862771904301876460223659-841777243238722532-19184155844391...

result:

wrong answer 1st lines differ - expected: '806084096', found: '-790087949-1068245673963460666...16-6...

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 1204kb

input:

481 526
8409 14498 18636 10027 24362 32458 17986 17730 11956 19192 2193 1034 29317 19284 16210 26242...

output:

-592322073-573688603-712742658-112453365133-42121891-10671942121648803015465845648128970393835777-70...

result:

wrong answer 1st lines differ - expected: '867105097', found: '-592322073-573688603-712742658...1468...

Test #3:

score: 0
Time Limit Exceeded

input:

100000 100000
15247 4194 9619 4532 22058 2667 21549 16652 25327 12018 13395 11426 7243 11714 22904 2...

output:

5443354445774135248764882525935532381851235929450382183004572019138459644406335593095352414985280034...

result:


Test #4:

score: 0
Time Limit Exceeded

input:

100000 100000
6264 26207 28424 24165 4852 20798 5803 18679 24588 12238 25786 28622 19900 101 25922 2...

output:

1892313111195417163444732091806547311802779973523560023197971597894576950714613136953630818249228594...

result:


Test #5:

score: 0
Time Limit Exceeded

input:

100000 100000
15043 9299 7163 25384 24996 3803 24356 12466 22073 12987 8931 14997 3951 32704 23076 8...

output:

7543470976296588341566791598758180064833683-83677372639535703017635175222109528057193329299575103101...

result:


Test #6:

score: 0
Time Limit Exceeded

input:

100000 100000
14736 16956 19864 23894 29403 5507 12182 6188 17192 14440 18618 3970 15396 15037 23334...

output:

1700873008935797904165193121538325232236856418753342585446510797344028517157465595936107198833701872...

result:


Test #7:

score: 0
Wrong Answer
time: 3741ms
memory: 1584kb

input:

50000 50000
17799 29763 25337 21321 1391 31852 27418 28753 18524 14044 15976 18893 12274 22834 11348...

output:

19498-455761980768952494820491340504654942924940624423848901-38216911-681388393256928278665337419532...

result:

wrong answer 1st lines differ - expected: '19498', found: '19498-455761980768952494820491...632-8113...

Test #8:

score: 0
Wrong Answer
time: 2797ms
memory: 1584kb

input:

50000 50000
10654 14956 14287 25326 8102 30579 11682 23553 272 22672 14460 30241 13026 12738 4912 72...

output:

42652931014091608124037508165804615233429111-69473191103884939715627639-8466734554971222324278316135...

result:

wrong answer 1st lines differ - expected: '717018991', found: '426529310140916081240375081658...1387...

Test #9:

score: 0
Time Limit Exceeded

input:

90000 90000
29538 28214 24706 30393 27759 9002 13458 10243 15713 14881 10630 5593 7942 24578 29370 1...

output:

16439958738703020388840239187537270-321287680273399892787933363-40443907420822247593280847817264640-...

result:


Test #10:

score: 0
Time Limit Exceeded

input:

100000 100000
23515 49 31372 25112 16779 21279 30735 32743 14678 15189 1763 23114 32215 14873 20487 ...

output:

-89807743044506220598162677494786936945282699-8275799181359493-330428554225826211-95202429116647-979...

result: