結果
問題 | No.2942 Sigma Music Game Level Problem |
ユーザー |
|
提出日時 | 2024-10-18 21:43:30 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,617 ms / 6,000 ms |
コード長 | 763 bytes |
コンパイル時間 | 5,437 ms |
コンパイル使用メモリ | 310,488 KB |
実行使用メモリ | 26,812 KB |
最終ジャッジ日時 | 2024-11-14 22:59:25 |
合計ジャッジ時間 | 21,910 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include<atcoder/all> using namespace atcoder; using mint=atcoder::modint998244353; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define int long long signed main(){ int N,Q,L0;cin>>N>>Q>>L0; vector<int> A(N);for(auto&&e:A)cin>>e; const int max_Q=1000000; fenwick_tree<int> f(max_Q+1),g(max_Q+1); for(auto&&e:A)f.add(e,e),g.add(e,1); bool flg=0; while(Q--){ int t;cin>>t; if(t==1){ int l;cin>>l; f.add(l,l); g.add(l,1); } if(t==2){ int l,r;cin>>l>>r; int res1=g.sum(0,r+1)-g.sum(0,l); int res2=f.sum(0,r+1)-f.sum(0,l); cout<<res1<<" "<<res2<<endl; flg=1; } if(t==3){ int m;cin>>m; L0=m; } } if(flg==0){ cout<<"Not Found!"<<endl; } }