結果
問題 | No.1705 Mode of long array |
ユーザー |
![]() |
提出日時 | 2021-09-19 17:49:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 884 bytes |
コンパイル時間 | 1,366 ms |
コンパイル使用メモリ | 81,668 KB |
最終ジャッジ日時 | 2025-01-24 15:53:34 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 31 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <utility> using namespace std; using ll=long long; using Pll=pair<ll,ll>; int main(){ ll N,M; cin>>N>>M; vector<Pll> A(M); for(ll i=0;i<M;i++){ cin>>A.at(i).first; A.at(i).second=i+1; } sort(A.rbegin(),A.rend()); ll Q; cin>>Q; for(ll i=0;i<Q;i++){ ll T,X,Y; cin>>T>>X>>Y; if(T==1){ for(ll j=0;j<M;j++){ if(A.at(j).second==X){ A.at(j).first+=Y; } } }else if(T==2){ for(ll j=0;j<M;j++){ if(A.at(j).second==X){ A.at(j).first-=Y; } } }else{ sort(A.rbegin(),A.rend()); ll val=A.at(0).first; ll ans=-1; for(ll j=0;j<M;j++){ if(A.at(j).first!=val){ break; } ans=max(ans,A.at(j).second); } cout<<ans<<endl; } } return 0; }