MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / main

Function main

Data Structures/Interval Set.cpp:50–65  ·  view source on GitHub ↗

assign a value in range in each query in the end print the sum of the array elements

Source from the content-addressed store, hash-verified

48//assign a value in range in each query
49//in the end print the sum of the array elements
50int32_t main() {
51 int i, j, k, n, m, q, l, r, v;
52 cin >> n >> q;
53 se.init(n);
54 while(q--) {
55 cin >> l >> r >> v;
56 se.assign(l, r, v);
57 }
58 int ans = 0;
59 for(auto x : se.value) {
60 ans += 1LL * ((x.first.first - x.first.second + 1) % mod) * (x.second % mod) % mod;
61 ans %= mod;
62 }
63 cout << ans << endl;
64 return 0;
65}

Callers

nothing calls this directly

Calls 2

assignMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected