Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define ull unsigned long long
- #define pi 3.141592654
- #define NUM 1e18
- #define Mod 1'000'000'007
- #define fixed(n) fixed<<setprecision(n)
- #define cin(v) for(auto &i:v) cin >> i ;
- #define cout(v) for(auto &i:v) cout << i <<" ";
- #define vowel(x) (x=='e'||x=='a'||x=='i'||x=='o'||x=='u')
- #define small(x) (x>=97&&x<=122)
- #define capital(x) (x>=65&&x<=90)
- #define Tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
- #define Toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
- #define sz(x) (int)(x.size())
- #define all(v) ((v).begin()), ((v).end())
- #define allr(v) ((v).rbegin()), ((v).rend())
- #define updmax(a,b) a=max(a,b)
- #define updmin(a,b) a=min(a,b)
- #define ceil(a,b) ((a/b)+(a%b?1:0))
- /* asc -> 1 2 3 ,des -> 3 2 1 */
- /***********************************************************************************/
- using namespace std;
- void Rofyda_Elghadban(){
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- }
- ll partial[10000001]{},partial2[10000001]{};
- void solve(){
- ll n,m,q,counter=0;
- cin>>n>>m>>q;
- vector<ll>v(n),k,p;
- cin(v);
- while(m--){
- ll l,r,d;
- cin>>l>>r>>d;
- p.push_back(l);
- p.push_back(r);
- p.push_back(d);
- }
- map<ll,ll>mp;
- ll qq=q;
- while(q--){
- ll x,y;
- cin>>x>>y;
- k.push_back(x);
- k.push_back(y);
- partial2[x]+=1;
- partial2[y+1]-=1;
- }
- for(ll i=1;i<=qq;i++){
- partial2[i]+=partial2[i-1];
- }
- for(ll i=0;i<qq;i++){
- mp[i+1]=partial2[i+1];
- }
- for(ll i=0;i<p.size();i+=3){
- counter++;
- partial[p[i]]+=(p[i+2]*mp[counter]);
- partial[p[i+1]+1]-=(p[i+2]*mp[counter]);
- }
- for(ll i=1;i<=n;i++){
- partial[i]+=partial[i-1];
- }
- for(ll i=0;i<n;i++){
- v[i]+=partial[i+1];
- }
- cout(v);
- cout<<"\n";
- }
- int main(){
- Rofyda_Elghadban();
- // int t;
- // cin>>t;
- // while(t--){
- // solve();
- // }
- solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement