結果
問題 |
No.1705 Mode of long array
|
ユーザー |
|
提出日時 | 2025-06-30 10:48:34 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 233 ms / 3,000 ms |
コード長 | 641 bytes |
コンパイル時間 | 4,288 ms |
コンパイル使用メモリ | 285,744 KB |
実行使用メモリ | 10,368 KB |
最終ジャッジ日時 | 2025-06-30 10:48:48 |
合計ジャッジ時間 | 12,435 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N, M; cin >> N >> M; vector<ll> A(M); for(auto &i : A) { cin >> i; } set<pair<ll, ll>> S; for(ll i = 0; i < M; i++) { S.insert({A[i], i}); } ll Q; cin >> Q; while(Q--) { ll type, x, y; cin >> type >> x >> y; x--; if(type == 1) { S.erase({A[x], x}); A[x] += y; S.insert({A[x], x}); } else if(type == 2) { S.erase({A[x], x}); A[x] -= y; S.insert({A[x], x}); } else { cout << (*S.rbegin()).second + 1 << "\n"; } } }