結果
問題 |
No.1441 MErGe
|
ユーザー |
![]() |
提出日時 | 2021-03-26 23:11:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 870 bytes |
コンパイル時間 | 905 ms |
コンパイル使用メモリ | 80,156 KB |
実行使用メモリ | 8,832 KB |
最終ジャッジ日時 | 2024-11-29 01:26:28 |
合計ジャッジ時間 | 12,730 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 1 WA * 27 |
ソースコード
#include <iostream> #include <vector> #include <atcoder/lazysegtree> using namespace std; using namespace atcoder; int curn; int op(int a,int b) {return a+b;} int e() {return 0;} int mapping(int F,int x){return F*x;} int comp(int F,int G){return F*G;} int id() {return 1;} int chk(int x){ return x<=curn;} int main(){ int n,q; cin>>n>>q; vector<int> a(n),init(n,1),csum(n+1,0); for(int i=0;i<n;i++) cin>>a[i],csum[i+1]=csum[i]+a[i]; lazy_segtree<int,op,e,int,mapping,comp,id> seg(init); int t,l,r; for(int i=0;i<q;i++){ cin>>t>>l>>r; curn=seg.all_prod()-l; l=seg.min_left(n,chk);l--; curn=seg.all_prod()-r; r=seg.min_left(n,chk); if(t==1){ seg.apply(l,r,0); seg.set(l,1); }else{ cout<<csum[r]-csum[l]<<endl; } } return 0; }