結果

問題 No.2942 Sigma Music Game Level Problem
ユーザー VvyLw
提出日時 2024-10-18 23:46:30
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 409 ms / 6,000 ms
コード長 1,249 bytes
コンパイル時間 2,292 ms
コンパイル使用メモリ 114,044 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-11-15 06:34:04
合計ジャッジ時間 9,834 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#ifdef local
#include <C++/core/io/debug_print.hpp>
#else
#define dump(...) void(0);
#endif

#include <iostream>
#include <ranges>
#include <atcoder/fenwicktree>
namespace man {

}
int main() {
    std::cin.tie(nullptr) -> sync_with_stdio(false);
    using namespace std::views;
    int n, q, l0;
    std::cin >> n >> q >> l0;
    atcoder::fenwick_tree<int64_t> cnt(1 << 18), bit(1 << 18);
    for([[maybe_unused]] const auto _: iota(0, n)) {
        int a;
        std::cin >> a;
        cnt.add(a, 1);
        bit.add(a, a);
    }
    bool none = true;
    for([[maybe_unused]] const auto _: iota(0, q)) {
        int t;
        std::cin >> t;
        if(t == 1) {
            int l;
            std::cin >> l;
            cnt.add(l, 1);
            bit.add(l, l);
        } else if(t == 2) {
            none = false;
            int l, r;
            std::cin >> l >> r;
            r++;
            std::cout << cnt.sum(l, r) << ' ' << bit.sum(l, r) << '\n';
        } else {
            int m;
            std::cin >> m;
        }
    }
    if(none) {
        std::cout << "Not Found!\n";
    }
}
0