結果

問題 No.1705 Mode of long array
ユーザー harurunharurun
提出日時 2021-09-19 17:49:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 884 bytes
コンパイル時間 1,573 ms
コンパイル使用メモリ 83,152 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-09-30 09:36:24
合計ジャッジ時間 10,603 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 9 ms
4,376 KB
testcase_04 AC 10 ms
4,376 KB
testcase_05 AC 11 ms
4,376 KB
testcase_06 AC 59 ms
4,380 KB
testcase_07 AC 44 ms
4,380 KB
testcase_08 AC 37 ms
4,380 KB
testcase_09 AC 23 ms
4,376 KB
testcase_10 AC 25 ms
4,380 KB
testcase_11 AC 59 ms
4,380 KB
testcase_12 AC 45 ms
4,376 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0