結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー haihamabossuhaihamabossu
提出日時 2024-10-18 22:36:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 381 ms / 6,000 ms
コード長 927 bytes
コンパイル時間 2,033 ms
コンパイル使用メモリ 204,364 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-18 22:52:59
合計ジャッジ時間 9,288 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 4 ms
6,816 KB
testcase_02 AC 4 ms
6,816 KB
testcase_03 AC 4 ms
6,820 KB
testcase_04 AC 4 ms
6,820 KB
testcase_05 AC 4 ms
6,820 KB
testcase_06 AC 4 ms
6,816 KB
testcase_07 AC 4 ms
6,820 KB
testcase_08 AC 4 ms
6,820 KB
testcase_09 AC 4 ms
6,824 KB
testcase_10 AC 4 ms
6,820 KB
testcase_11 AC 159 ms
6,820 KB
testcase_12 AC 366 ms
6,820 KB
testcase_13 AC 312 ms
6,820 KB
testcase_14 AC 206 ms
6,820 KB
testcase_15 AC 139 ms
6,820 KB
testcase_16 AC 277 ms
6,820 KB
testcase_17 AC 79 ms
6,816 KB
testcase_18 AC 232 ms
6,816 KB
testcase_19 AC 372 ms
6,820 KB
testcase_20 AC 113 ms
6,820 KB
testcase_21 AC 363 ms
6,816 KB
testcase_22 AC 330 ms
6,820 KB
testcase_23 AC 118 ms
6,816 KB
testcase_24 AC 4 ms
6,820 KB
testcase_25 AC 4 ms
6,820 KB
testcase_26 AC 381 ms
6,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/fenwicktree>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

const ll MX = 200020;
void solve() {
  ll n, q, L;
  cin >> n >> q >> L;
  atcoder::fenwick_tree<ll> ft1(MX), ft2(MX);
  auto add = [&](ll a) -> void {
    ft1.add(a, 1);
    ft2.add(a, a);
  };
  rep(i, n) {
    ll a;
    cin >> a;
    add(a);
  }
  bool found = false;
  rep(qi, q) {
    ll t;
    cin >> t;
    if (t == 1) {
      ll l;
      cin >> l;
      add(l);
    }
    if (t == 2) {
      found = true;
      ll l, r;
      cin >> l >> r;
      cout << ft1.sum(l, r + 1) << ' ' << ft2.sum(l, r + 1) << '\n';
    }
    if (t == 3) {
      cin >> L;
    }
  }
  if (!found) {
    cout << "Not Found!\n";
  }
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  int T = 1;
  for (int t = 0; t < T; t++) {
    solve();
  }
  return 0;
}
0