QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#431475 | #6857. Easy problem II | ucup-team3591# | AC ✓ | 2696ms | 4260kb | C++17 | 849b | 2024-06-05 17:02:54 | 2024-06-05 17:02:54 |
Judging History
answer
//Man always remember love because of romance only!
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
int X=0,w=0; char ch=0;
while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
while(isdigit(ch)) X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
return w?-X:X;
}
inline void write(int x){
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
int a[100001];
signed main(){
int T=read();
while(T--){
int n=read(),q=read();
for(int i=1;i<=n;i++) a[i]=read();
while(q--){
int op=read(),l=read(),r=read();
if(op==1){
int x=read();
for(int i=l;i<=r;i++) a[i]=(a[i]<x)?x-a[i]:x+a[i];
}else{
int ans=0;
for(int i=l;i<=r;i++) ans+=a[i];
write(ans);
putchar('\n');
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2696ms
memory: 4260kb
input:
1 100000 100000 9994250 1 9999152 1 9996205 1 9993920 1 9992936 1 9999312 1 9994863 1 9999950 1 9994702 1 9998302 1 9997460 1 9995584 1 9990858 1 9995764 1 9992400 1 9992970 1 9993486 1 9992200 1 9991250 1 9990336 1 9994212 1 9992704 1 9999400 1 9994826 1 9996272 1 9995920 1 9994960 1 9996400 1 9990...
output:
474104664177 469903014249 480933011291 483822399944 484396591822 485195157450 476873328231 500050522935 490495899612 455001143708 459350186600 463088605817 452789422852 457530804729 478921256445 483860248443 460953094343 461203887676 471567676461 499102979676 483610787357 490750641096 468023668995 4...
result:
ok 85563 lines