-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathincrementing segment querry.cp
More file actions
90 lines (88 loc) · 1.78 KB
/
incrementing segment querry.cp
File metadata and controls
90 lines (88 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//#include <bits/stdc++.h>
#include <iostream>
#include <climits>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <algorithm>
#include <fstream>
#include <cmath>
#include<math.h>
#include <set>
#include <time.h>
#include <map>
#include <fstream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <numeric>
#include <unordered_map>
using namespace std;
#define sz(a) int((a).size())
#define ll long long
#define pb push_back
#define ld long double
#define mp make_pair
#define vi vector<ll>
#define all(c) (c).begin(),(c).end()
#define allr(c) (c).rbegin(),(c).rend()
#define rep(i,n) for(ll i=0;i<n;i++)
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define input(a,n) for(long long i=0;i<n;i++)cin>>a[i]
#define output(a,n) for(long long i=0;i<n;i++)cout<<a[i]<<" "
#define she_taught_me_to_code cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ep 1e-10
#define pi pair<ll,ll>
#define inf 10e9
#define N 1000000
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
return (a.second < b.second);
}
ll gcd(ll a,ll b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
ll lcm1(ll a,ll b)
{
return (a*b)/gcd(a,b);
}
int main()
{
she_taught_me_to_code
// freopen("input.txt","r",stdin);
// freopen("input.txt","w",stdout);
ll n;
cin>>n;
vi v(n),p(n+1,0);
input(v,n);
ll t;
cin>>t;
while(t--)
{
ll a,b,c;
cin>>a>>b>>c;
p[a]+=c;
p[b+1]-=c;
}
for(ll i=1;i<n;i++)
{
p[i]+=p[i-1];
}
for(ll i=0;i<n;i++)
{
cout<<v[i]+p[i]<<" ";
}
}