formatting source-code for 153fb7b8a5

This commit is contained in:
github-actions
2020-05-30 04:02:09 +00:00
parent 92fe9495ec
commit 8a2de9842b
175 changed files with 1671 additions and 3460 deletions

View File

@@ -12,19 +12,15 @@ const int maxn = 1e5 + 7;
int tree[maxn] = {0},
range; // segement of [1...range], notice it must be less than `maxn`
void update(int x, int c)
{
while (x <= range)
{
void update(int x, int c) {
while (x <= range) {
tree[x] += c;
x += lowbit(x);
}
}
int query(int x)
{
int query(int x) {
int ans = 0;
while (x)
{
while (x) {
ans += tree[x];
x -= lowbit(x);
}
@@ -32,29 +28,23 @@ int query(int x)
}
int query_segement(int l, int r) { return query(r) - query(l - 1); }
int main()
{
int main() {
cin >> range;
for (int i = 1; i <= range; i++)
{
for (int i = 1; i <= range; i++) {
int num;
cin >> num;
update(i, num);
}
int q;
cin >> q;
while (q--)
{
while (q--) {
int op;
cin >> op;
if (op == 0)
{
if (op == 0) {
int l, r;
cin >> l >> r;
cout << query_segement(l, r) << endl;
}
else
{
} else {
int x, c;
cin >> x >> c;
update(x, c);