結果

問題 No.1705 Mode of long array
ユーザー publflpublfl
提出日時 2021-10-08 23:03:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 184 ms / 3,000 ms
コード長 687 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 53,120 KB
実行使用メモリ 10,132 KB
最終ジャッジ日時 2023-09-30 12:23:13
合計ジャッジ時間 7,282 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 5 ms
4,376 KB
testcase_12 AC 5 ms
4,376 KB
testcase_13 AC 126 ms
8,556 KB
testcase_14 AC 73 ms
6,280 KB
testcase_15 AC 52 ms
4,376 KB
testcase_16 AC 66 ms
4,376 KB
testcase_17 AC 47 ms
4,376 KB
testcase_18 AC 39 ms
4,376 KB
testcase_19 AC 84 ms
5,224 KB
testcase_20 AC 50 ms
4,612 KB
testcase_21 AC 90 ms
7,888 KB
testcase_22 AC 139 ms
9,504 KB
testcase_23 AC 51 ms
4,376 KB
testcase_24 AC 51 ms
4,376 KB
testcase_25 AC 51 ms
4,380 KB
testcase_26 AC 51 ms
4,376 KB
testcase_27 AC 51 ms
4,376 KB
testcase_28 AC 52 ms
4,380 KB
testcase_29 AC 51 ms
4,380 KB
testcase_30 AC 51 ms
4,376 KB
testcase_31 AC 52 ms
4,376 KB
testcase_32 AC 51 ms
4,380 KB
testcase_33 AC 173 ms
10,072 KB
testcase_34 AC 179 ms
10,096 KB
testcase_35 AC 178 ms
10,080 KB
testcase_36 AC 174 ms
10,076 KB
testcase_37 AC 179 ms
10,088 KB
testcase_38 AC 176 ms
10,072 KB
testcase_39 AC 179 ms
10,052 KB
testcase_40 AC 177 ms
10,012 KB
testcase_41 AC 184 ms
10,092 KB
testcase_42 AC 177 ms
10,128 KB
testcase_43 AC 71 ms
10,132 KB
testcase_44 AC 71 ms
10,068 KB
testcase_45 AC 71 ms
10,076 KB
testcase_46 AC 71 ms
10,016 KB
testcase_47 AC 70 ms
10,100 KB
testcase_48 AC 70 ms
10,076 KB
testcase_49 AC 124 ms
10,108 KB
testcase_50 AC 129 ms
10,108 KB
testcase_51 AC 121 ms
10,052 KB
testcase_52 AC 123 ms
10,016 KB
testcase_53 AC 120 ms
10,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <set>

std::set< std::pair<long long int,int> > S;
long long int count[100010];

int main()
{
	long long int a;
	int b;
	scanf("%lld%d",&a,&b);
	for(int i=1;i<=b;i++)
	{
		long long int c;
		scanf("%lld",&c);
		count[i] = c;
	}
	
	for(int i=1;i<=b;i++) S.insert(std::make_pair(count[i],i));
	
	int c;
	scanf("%d",&c);
	while(c--)
	{
		int d,e;
		long long int f;
		scanf("%d%d%lld",&d,&e,&f);
		if(d==3)
		{
			std::set< std::pair<long long int,int> > ::iterator it = S.end();
			it--;
			printf("%d\n",it->second);
		}
		else
		{
			if(d==2) f*=(-1);
			S.erase(std::make_pair(count[e],e));
			count[e] += f;
			S.insert(std::make_pair(count[e],e));
		}
	}
}
0