結果
| 問題 |
No.1705 Mode of long array
|
| コンテスト | |
| ユーザー |
publfl
|
| 提出日時 | 2021-10-08 23:03:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 204 ms / 3,000 ms |
| コード長 | 687 bytes |
| コンパイル時間 | 661 ms |
| コンパイル使用メモリ | 52,352 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2024-07-23 06:25:41 |
| 合計ジャッジ時間 | 7,616 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
#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));
}
}
}
publfl