Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int land[1010];
- int main(){
- int n,m;
- cin >> n >> m;
- int a,b,x;
- for(int i=0;i<m;++i){
- int max1=-1e9;
- cin >> a >> b >> x;
- for(int i=a;i<=b;++i){
- land[i]+=x;
- }
- for(int i=1;i<=n;++i){
- if(land[i]>max1){
- max1=land[i];
- }
- }
- int cnt=0;
- for(int i=1;i<=n;++i){
- if(max1==0&&land[1]==0&&i==1){
- ++cnt;
- }
- if(land[i]==max1&&land[i]!=land[i-1]){
- ++cnt;
- }
- }
- cout << max1 << " " << cnt << "\n";
- }
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement