//pransh_8
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <algorithm>
using namespace __gnu_pbds;
using namespace std;
//Macros:
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define all(a) a.begin(),a.end()
#define ff first
#define ss second
#define int long long
#define inf 9223372036854775807
#define pii pair<int, int>
#define vtr vector
#define pob pop_back
#define pb push_back
#define endl "\n"
#define tab "\t"
#define spc ' '
#define typ typename
#define printif(condition,str1,str2) cout<<((condition)?str1:str2) << endl
#define FOR(i, a, n) for(int i=a;i<n;++i)
#define FORR(i, a, n) for(int i=a;i>=n;--i)
/*------------------------------Code-Begins----------------------------------*/
signed main() {
int n, q;
cin >> n;
vtr<int> c(n);
FOR(i,0,n) cin >> c[i];
cin >> q;
vtr<int> l(q), r(q), v(q);
FOR(i,0,q) cin >> l[i] >> r[i] >> v[i];
vtr<int> ans(n);
FOR(i,0,q) {
FOR(k,l[i]-1,r[i]) {
if (v[i]>0)
ans[k]=min(c[k],ans[k]+v[i]);
else
ans[k]=max(0ll,ans[k]+v[i]);
}
}
FOR(i,0,n)
cout << ans[i] << spc;
return 0;
}
Compilation message
/usr/bin/ld: /tmp/ccbTT1wP.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccvjFGLP.o:candies.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccbTT1wP.o: in function `main':
grader.cpp:(.text.startup+0x30e): undefined reference to `distribute_candies(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status