結果
問題 | No.1705 Mode of long array |
ユーザー | KoD |
提出日時 | 2021-10-08 22:26:52 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 187 ms / 3,000 ms |
コード長 | 1,732 bytes |
コンパイル時間 | 3,675 ms |
コンパイル使用メモリ | 254,116 KB |
実行使用メモリ | 10,248 KB |
最終ジャッジ日時 | 2023-09-30 10:57:51 |
合計ジャッジ時間 | 10,543 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 5 ms
4,380 KB |
testcase_07 | AC | 5 ms
4,380 KB |
testcase_08 | AC | 6 ms
4,380 KB |
testcase_09 | AC | 5 ms
4,376 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 | 111 ms
8,676 KB |
testcase_14 | AC | 65 ms
6,208 KB |
testcase_15 | AC | 48 ms
4,380 KB |
testcase_16 | AC | 62 ms
4,380 KB |
testcase_17 | AC | 42 ms
4,380 KB |
testcase_18 | AC | 36 ms
4,384 KB |
testcase_19 | AC | 76 ms
5,300 KB |
testcase_20 | AC | 46 ms
4,772 KB |
testcase_21 | AC | 79 ms
7,760 KB |
testcase_22 | AC | 133 ms
9,644 KB |
testcase_23 | AC | 47 ms
4,376 KB |
testcase_24 | AC | 47 ms
4,376 KB |
testcase_25 | AC | 47 ms
4,380 KB |
testcase_26 | AC | 48 ms
4,376 KB |
testcase_27 | AC | 47 ms
4,376 KB |
testcase_28 | AC | 47 ms
4,380 KB |
testcase_29 | AC | 47 ms
4,380 KB |
testcase_30 | AC | 47 ms
4,380 KB |
testcase_31 | AC | 47 ms
4,376 KB |
testcase_32 | AC | 47 ms
4,376 KB |
testcase_33 | AC | 178 ms
10,132 KB |
testcase_34 | AC | 183 ms
10,248 KB |
testcase_35 | AC | 186 ms
10,132 KB |
testcase_36 | AC | 183 ms
10,120 KB |
testcase_37 | AC | 187 ms
10,104 KB |
testcase_38 | AC | 182 ms
10,132 KB |
testcase_39 | AC | 181 ms
10,104 KB |
testcase_40 | AC | 185 ms
10,132 KB |
testcase_41 | AC | 184 ms
10,008 KB |
testcase_42 | AC | 184 ms
10,176 KB |
testcase_43 | AC | 64 ms
10,104 KB |
testcase_44 | AC | 64 ms
10,120 KB |
testcase_45 | AC | 64 ms
10,116 KB |
testcase_46 | AC | 64 ms
10,128 KB |
testcase_47 | AC | 64 ms
9,988 KB |
testcase_48 | AC | 64 ms
10,008 KB |
testcase_49 | AC | 117 ms
10,116 KB |
testcase_50 | AC | 116 ms
10,180 KB |
testcase_51 | AC | 115 ms
10,124 KB |
testcase_52 | AC | 116 ms
10,064 KB |
testcase_53 | AC | 116 ms
10,120 KB |
ソースコード
#include <bits/stdc++.h> using i32 = std::int32_t; using u32 = std::uint32_t; using i64 = std::int64_t; using u64 = std::uint64_t; using isize = std::ptrdiff_t; using usize = std::size_t; class rep { struct Iter { usize itr; constexpr Iter(const usize pos) noexcept : itr(pos) {} constexpr void operator++() noexcept { ++itr; } constexpr bool operator!=(const Iter& other) const noexcept { return itr != other.itr; } constexpr usize operator*() const noexcept { return itr; } }; const Iter first, last; public: explicit constexpr rep(const usize first, const usize last) noexcept : first(first), last(std::max(first, last)) {} constexpr Iter begin() const noexcept { return first; } constexpr Iter end() const noexcept { return last; } }; template <class T> using Vec = std::vector<T>; void main_() { u64 N; usize M; std::cin >> N >> M; Vec<u64> A(M); for (auto& x : A) { std::cin >> x; } std::set<std::pair<u64, usize>> set; for (const auto i : rep(0, M)) { set.emplace(A[i], i); } usize Q; std::cin >> Q; while (Q--) { usize t, x; u64 y; std::cin >> t >> x >> y; if (t == 1) { x -= 1; set.erase(std::make_pair(A[x], x)); A[x] += y; set.emplace(A[x], x); } else if (t == 2) { x -= 1; set.erase(std::make_pair(A[x], x)); A[x] -= y; set.emplace(A[x], x); } else { std::cout << set.rbegin()->second + 1 << '\n'; } } } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); main_(); return 0; }