//solve atcoder problem //memo:for (const auto &e : e) { #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define foreach(e, m) for (const auto &(e) : (m)) #define ll long long #define ldf long double #define flout std::fixed << std::setprecision(15) << #define txt freopen("wormsort.in", "r", stdin), freopen("wormsort.out", "w", stdout); #define dmap unordered_map #define dmin(x) *min_element(begin(x), end(x)) #define dmax(x) *max_element(begin(x), end(x)) #define huge 4e18 #define intbig (ll)2e9 #define vec2(t) vector> #define vec3(t) vector>> #define bit(x) (1LL << (x)) #define r_up(x, y) (((x) + (y) - 1) / (y)) #define jun_end(a) } while (next_permutation(a.begin(), a.end())); #define pll pair // #define __popcnt __builtin_popcount // #define __popcnt64 __builtin_popcountll #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const ll MOD = 1e9 + 7; const ll MOD9 = 998244353; vector inp() { string input;getline(cin,input);stringstream ss(input);vector result;ll number;while(ss >> number) { result.push_back(number); }return result; } map tally(vector& a) { map h;for(ll i = 0; i < a.size(); i++) { h[a[i]]++; }return h; } ll gcd(ll a,ll b) { if(b == 0) { return a; }return gcd(b,a % b); } ll modpow(ll a,ll n,ll mod) { ll res = 1;while(n > 0) { if(n & 1) { res = res * a % mod; }a = a * a % mod;n >>= 1; }return res; } ll lcm(ll a,ll b) { return a / gcd(a,b) * b; } ll kaijo(ll n,ll mod) { ll res = 1;for(ll i = 1; i <= n; i++) { res *= i;res %= mod; }return res; } ll comb(ll n,ll k,ll mod) { ll res = 1;for(ll i = 1; i <= k; i++) { res *= n - i + 1;res %= mod;res *= modpow(i,mod - 2,mod);res %= mod; }return res; } ll isqrt(ll n,bool f = false) { if(n == 1) { return 1; }ll a = sqrtl(n + 1);if(a * a > n) { a--; }if(f) { if(a * a != n) { return a + 1; } }return a; } template TTM sum(vector a) { TTM sum = 0;for(ll i = 0; i < a.size(); i++) { sum += a[i]; }return sum; } vector> matrix_mul(vector>& a,vector>& b,ll mod) { ll n = a.size();ll m = a[0].size();ll l = b[0].size();vector> c(n,vector(l,0));for(ll i = 0; i < n; i++) { for(ll j = 0; j < l; j++) { for(ll k = 0; k < m; k++) { c[i][j] += a[i][k] * b[k][j];c[i][j] %= mod; } } }return c; } vector inpf() { string input;getline(cin,input);stringstream ss(input);vector result;ldf number;while(ss >> number) { result.push_back(number); }return result; } ll s_maxop(ll a,ll b) { return max(b,a); } ll s_maxe() { return 0; } template vector csum(vector& a,bool f = false) { vector res(a.size() + 1,0);for(ll i = 0; i < a.size(); i++) { res[i + 1] = res[i] + a[i]; }if(f) { res.erase(res.begin()); }return res; } template vector colum(vector>& a,ll col) { ll n = a.size();vector res(0);for(ll i = 0; i < n; i++) { res.push_back(res[i][col]); }return res; } template vector p_col(vector>& a,bool f = true) { ll n = a.size();vector res(0);for(ll i = 0; i < n; i++) { if(f) { res.push_back(a[i].first); } else { res.push_back(a[i].second); } }return res; } /* ll dfs(ll x,ll prev) { rep(i, links[x].size()) { ll y = links[x][i]; if(y == prev) { continue; } dfs(y,x); } return 0LL; } */ ll n,x; vec2(ll) datas; #include #include #include namespace internal { #ifndef _MSC_VER template using is_signed_int128 = typename std::conditional::value || std::is_same::value, std::true_type, std::false_type>::type; template using is_unsigned_int128 = typename std::conditional::value || std::is_same::value, std::true_type, std::false_type>::type; template using make_unsigned_int128 = typename std::conditional::value, __uint128_t, unsigned __int128>; template using is_integral = typename std::conditional::value || is_signed_int128::value || is_unsigned_int128::value, std::true_type, std::false_type>::type; template using is_signed_int = typename std::conditional<(is_integral::value&& std::is_signed::value) || is_signed_int128::value, std::true_type, std::false_type>::type; template using is_unsigned_int = typename std::conditional<(is_integral::value&& std::is_unsigned::value) || is_unsigned_int128::value, std::true_type, std::false_type>::type; template using to_unsigned = typename std::conditional< is_signed_int128::value, make_unsigned_int128, typename std::conditional::value, std::make_unsigned, std::common_type>::type>::type; #else template using is_integral = typename std::is_integral; template using is_signed_int = typename std::conditional::value&& std::is_signed::value, std::true_type, std::false_type>::type; template using is_unsigned_int = typename std::conditional::value&& std::is_unsigned::value, std::true_type, std::false_type>::type; template using to_unsigned = typename std::conditional::value, std::make_unsigned, std::common_type>::type; #endif template using is_signed_int_t = std::enable_if_t::value>; template using is_unsigned_int_t = std::enable_if_t::value>; template using to_unsigned_t = typename to_unsigned::type; } // namespace internal // Reference: https://en.wikipedia.org/wiki/Fenwick_tree template struct fenwick_tree { using U = internal::to_unsigned_t; public: fenwick_tree() : _n(0) {} fenwick_tree(int n) : _n(n),data(n) {} void add(int p,T x) { assert(0 <= p && p < _n); p++; while(p <= _n) { data[p - 1] += U(x); p += p & -p; } } T sum(int l,int r) { assert(0 <= l && l <= r && r <= _n); return sum(r) - sum(l); } private: int _n; std::vector data; U sum(int r) { U s = 0; while(r > 0) { s += data[r - 1]; r -= r & -r; } return s; } }; vector> links; // must use int not ll // intを使わないように注意! int main() { ll n,q,l; cin >> n >> q >> l;cin.ignore(); fenwick_tree fw(200001); fenwick_tree cw(200001); vector a(n); rep(i, n) { cin >> a[i]; cw.add(a[i],1); fw.add(a[i],a[i]); } bool flag = true; rep(i,q) { ll t; cin >> t; if(t == 1) { ll l; cin >> l; cw.add(l,1); fw.add(l,l); }else if(t == 2) { ll l,r; cin >> l >> r; ll count; ll sum; count = cw.sum(l,r+1); sum = fw.sum(l,r+1); flag = false; cout << count << " " << sum << endl; } else { ll m; cin >> m; } } if(flag) { cout << "Not Found!" << endl; } return 0; } /*test case 1 2 5 0 5 5 */