結果
問題 | No.2942 Sigma Music Game Level Problem |
ユーザー |
![]() |
提出日時 | 2024-10-18 21:44:09 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 381 ms / 6,000 ms |
コード長 | 984 bytes |
コンパイル時間 | 1,126 ms |
コンパイル使用メモリ | 91,780 KB |
実行使用メモリ | 5,760 KB |
最終ジャッジ日時 | 2024-11-15 06:41:51 |
合計ジャッジ時間 | 8,845 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <iostream> #include <atcoder/fenwicktree> using namespace std; int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int N, Q, L0; cin >> N >> Q >> L0; // vector<int> L(Q + 1); // L[0] = L0; auto Li = L0; constexpr int K = 201010; atcoder::fenwick_tree<int> fw0(K); atcoder::fenwick_tree<long long> fw1(K); for (int i = 0; i < N; ++i) { int a; cin >> a; fw0.add(a, 1); fw1.add(a, a); } bool has2 = false; for (int i = 1; i <= Q; ++i) { int tp; cin >> tp; if (tp == 1) { int l; cin >> l; fw0.add(l, 1); fw1.add(l, l); } else if (tp == 2) { int l, r; cin >> l >> r; ++r; cout << fw0.sum(l, r) << ' ' << fw1.sum(l, r) << '\n'; has2 = true; } else { cin >> Li; } } if (!has2) puts("Not Found!"); }