結果

問題 No.1705 Mode of long array
ユーザー kotatsugamekotatsugame
提出日時 2021-10-08 22:20:43
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 240 ms / 3,000 ms
コード長 614 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 75,120 KB
実行使用メモリ 8,904 KB
最終ジャッジ日時 2023-09-30 10:44:43
合計ジャッジ時間 9,546 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 9 ms
4,380 KB
testcase_07 AC 12 ms
4,376 KB
testcase_08 AC 12 ms
4,380 KB
testcase_09 AC 10 ms
4,380 KB
testcase_10 AC 10 ms
4,376 KB
testcase_11 AC 10 ms
4,380 KB
testcase_12 AC 10 ms
4,380 KB
testcase_13 AC 141 ms
8,268 KB
testcase_14 AC 103 ms
5,576 KB
testcase_15 AC 109 ms
4,380 KB
testcase_16 AC 130 ms
4,380 KB
testcase_17 AC 94 ms
4,380 KB
testcase_18 AC 76 ms
4,380 KB
testcase_19 AC 143 ms
4,636 KB
testcase_20 AC 87 ms
4,376 KB
testcase_21 AC 109 ms
8,228 KB
testcase_22 AC 159 ms
8,356 KB
testcase_23 AC 89 ms
4,376 KB
testcase_24 AC 88 ms
4,380 KB
testcase_25 AC 89 ms
4,376 KB
testcase_26 AC 88 ms
4,376 KB
testcase_27 AC 89 ms
4,376 KB
testcase_28 AC 89 ms
4,376 KB
testcase_29 AC 89 ms
4,380 KB
testcase_30 AC 90 ms
4,380 KB
testcase_31 AC 89 ms
4,376 KB
testcase_32 AC 89 ms
4,380 KB
testcase_33 AC 159 ms
8,820 KB
testcase_34 AC 156 ms
8,676 KB
testcase_35 AC 156 ms
8,676 KB
testcase_36 AC 155 ms
8,856 KB
testcase_37 AC 156 ms
8,764 KB
testcase_38 AC 155 ms
8,788 KB
testcase_39 AC 156 ms
8,760 KB
testcase_40 AC 156 ms
8,624 KB
testcase_41 AC 156 ms
8,808 KB
testcase_42 AC 155 ms
8,756 KB
testcase_43 AC 240 ms
8,680 KB
testcase_44 AC 234 ms
8,808 KB
testcase_45 AC 233 ms
8,680 KB
testcase_46 AC 236 ms
8,680 KB
testcase_47 AC 236 ms
8,888 KB
testcase_48 AC 236 ms
8,628 KB
testcase_49 AC 174 ms
8,720 KB
testcase_50 AC 172 ms
8,904 KB
testcase_51 AC 172 ms
8,728 KB
testcase_52 AC 174 ms
8,816 KB
testcase_53 AC 177 ms
8,868 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/segtree>
using namespace std;
using dat=pair<long,int>;
dat op(dat a,dat b){return a<b?b:a;}
dat e(){return make_pair(-1,-1);}
main()
{
	long N;
	int M;
	cin>>N>>M;
	vector<dat>init(M);
	for(int i=0;i<M;i++)
	{
		long a;cin>>a;
		init[i]=make_pair(a,i);
	}
	atcoder::segtree<dat,op,e>P(init);
	int Q;cin>>Q;
	for(;Q--;)
	{
		int t,x;
		long y;
		cin>>t>>x>>y;
		x--;
		if(t==1)
		{
			dat now=P.get(x);
			now.first+=y;
			P.set(x,now);
		}
		else if(t==2)
		{
			dat now=P.get(x);
			now.first-=y;
			P.set(x,now);
		}
		else
		{
			cout<<P.all_prod().second+1<<"\n";
		}
	}
}
0