結果
問題 | No.1705 Mode of long array |
ユーザー | Ricky_pon |
提出日時 | 2021-10-08 22:50:14 |
言語 | C++17 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 367 ms / 3,000 ms |
コード長 | 2,333 bytes |
コンパイル時間 | 2,448 ms |
コンパイル使用メモリ | 215,496 KB |
実行使用メモリ | 16,316 KB |
最終ジャッジ日時 | 2023-09-30 11:58:09 |
合計ジャッジ時間 | 12,426 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 3 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 3 ms
4,380 KB |
testcase_06 | AC | 6 ms
4,376 KB |
testcase_07 | AC | 7 ms
4,376 KB |
testcase_08 | AC | 7 ms
4,376 KB |
testcase_09 | AC | 6 ms
4,380 KB |
testcase_10 | AC | 6 ms
4,380 KB |
testcase_11 | AC | 7 ms
4,376 KB |
testcase_12 | AC | 6 ms
4,380 KB |
testcase_13 | AC | 211 ms
13,432 KB |
testcase_14 | AC | 124 ms
9,288 KB |
testcase_15 | AC | 75 ms
4,856 KB |
testcase_16 | AC | 102 ms
5,496 KB |
testcase_17 | AC | 68 ms
4,788 KB |
testcase_18 | AC | 59 ms
5,004 KB |
testcase_19 | AC | 140 ms
7,464 KB |
testcase_20 | AC | 80 ms
6,276 KB |
testcase_21 | AC | 158 ms
12,156 KB |
testcase_22 | AC | 249 ms
15,064 KB |
testcase_23 | AC | 58 ms
4,376 KB |
testcase_24 | AC | 58 ms
4,376 KB |
testcase_25 | AC | 58 ms
4,380 KB |
testcase_26 | AC | 59 ms
4,376 KB |
testcase_27 | AC | 59 ms
4,376 KB |
testcase_28 | AC | 59 ms
4,376 KB |
testcase_29 | AC | 58 ms
4,376 KB |
testcase_30 | AC | 58 ms
4,376 KB |
testcase_31 | AC | 58 ms
4,376 KB |
testcase_32 | AC | 59 ms
4,376 KB |
testcase_33 | AC | 345 ms
15,992 KB |
testcase_34 | AC | 340 ms
16,300 KB |
testcase_35 | AC | 342 ms
16,260 KB |
testcase_36 | AC | 353 ms
16,112 KB |
testcase_37 | AC | 347 ms
16,044 KB |
testcase_38 | AC | 354 ms
16,044 KB |
testcase_39 | AC | 352 ms
16,304 KB |
testcase_40 | AC | 367 ms
16,008 KB |
testcase_41 | AC | 348 ms
16,296 KB |
testcase_42 | AC | 349 ms
16,080 KB |
testcase_43 | AC | 107 ms
16,156 KB |
testcase_44 | AC | 106 ms
16,036 KB |
testcase_45 | AC | 107 ms
16,044 KB |
testcase_46 | AC | 107 ms
15,960 KB |
testcase_47 | AC | 107 ms
15,992 KB |
testcase_48 | AC | 107 ms
16,316 KB |
testcase_49 | AC | 219 ms
16,100 KB |
testcase_50 | AC | 216 ms
15,964 KB |
testcase_51 | AC | 216 ms
16,092 KB |
testcase_52 | AC | 215 ms
15,988 KB |
testcase_53 | AC | 212 ms
16,108 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> #include <algorithm> #include <cassert> #include <vector> template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } template <class T> T div_floor(T a, T b) { if (b < 0) a *= -1, b *= -1; return a >= 0 ? a / b : (a + 1) / b - 1; } template <class T> T div_ceil(T a, T b) { if (b < 0) a *= -1, b *= -1; return a > 0 ? (a - 1) / b + 1 : a / b; } template <typename T> struct CoordComp { std::vector<T> v; bool sorted; CoordComp() : sorted(false) {} int size() { return v.size(); } void add(T x) { v.push_back(x); } void build() { std::sort(v.begin(), v.end()); v.erase(std::unique(v.begin(), v.end()), v.end()); sorted = true; } int get_idx(T x) { assert(sorted); return lower_bound(v.begin(), v.end(), x) - v.begin(); } T &operator[](int i) { return v[i]; } }; #define For(i, a, b) for (int i = (int)(a); (i) < (int)(b); ++(i)) #define rFor(i, a, b) for (int i = (int)(a)-1; (i) >= (int)(b); --(i)) #define rep(i, n) For(i, 0, n) #define rrep(i, n) rFor(i, n, 0) #define fi first #define se second using namespace std; using lint = long long; using pii = pair<int, int>; using pll = pair<lint, lint>; using namespace atcoder; using mint = modint1000000007; int main() { lint n, m; scanf("%lld%lld", &n, &m); map<lint, lint> mp; auto cmp = [](const pll &p1, const pll &p2) { return p1 > p2; }; set<pll, decltype(cmp)> S(cmp); rep(i, m) { lint a; scanf("%lld", &a); mp[i + 1] = a; S.emplace(a, i + 1); } int q; scanf("%d", &q); rep(i, q) { int t; lint x, y; scanf("%d%lld%lld", &t, &x, &y); if (t == 1) { auto tmp = mp[x]; mp[x] = tmp + y; S.erase({tmp, x}); S.emplace(tmp + y, x); } else if (t == 2) { auto tmp = mp[x]; mp[x] = tmp - y; S.erase({tmp, x}); S.emplace(tmp - y, x); } else { printf("%lld\n", S.begin()->se); } } }