結果
問題 |
No.1705 Mode of long array
|
ユーザー |
|
提出日時 | 2024-09-16 09:06:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 176 ms / 3,000 ms |
コード長 | 838 bytes |
コンパイル時間 | 2,147 ms |
コンパイル使用メモリ | 198,328 KB |
最終ジャッジ日時 | 2025-02-24 08:56:15 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #include<atcoder/segtree> using namespace atcoder; using S=pair<ll,ll>; S op(S a,S b){ if(a.first<=b.first)return b; else return a; } S e(){return {-1,-1};}; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll N,M; cin>>N>>M; vector<pair<ll,ll>> A(M); for(int i=0;i<M;i++){ cin>>A[i].first; A[i].second=i; } segtree<S,op,e> seg(A); int Q; cin>>Q; for(int q=0;q<Q;q++){ ll T,X,Y; cin>>T>>X>>Y; if(T==1){ X--; seg.set(X,{seg.get(X).first+Y,X}); } else if(T==2){ X--; seg.set(X,{seg.get(X).first-Y,X}); } else{ cout<<seg.all_prod().second+1<<endl; } } }