Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
34489 | 方巾予 | 【S】T2 | C++ | 运行超时 | 0 | 1000 MS | 2844 KB | 923 | 2024-11-10 14:18:15 |
#include<bits/stdc++.h> using namespace std; const int N=2e5+10; int n,q; int a[N],op,l,r; priority_queue<int> pq; int f,s,t; signed main(){ scanf("%d%d",&n,&q); for(int i=1;i<=n;i++) scanf("%d",&a[i]); while(q--){ while(!pq.empty()) pq.pop(); scanf("%d%d%d",&op,&l,&r); if(op){ for(int i=l;i<=r;i++){ pq.push(a[i]); } f=pq.top(); pq.pop(); s=pq.top(); pq.pop(); t=pq.top(); pq.pop(); while(s+t<=f&&!pq.empty()){ f=s; s=t; t=pq.top(); pq.pop(); } if(s+t>f){ printf("%d\n",s+t+f); }else{ printf("0\n"); } }else{ a[l]=r; } } return 0; }