# | Submission time^{} |
Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|

129550 | 2019-07-12T13:33:15 Z | miguel | Foehn Phenomena (JOI17_foehn_phenomena) | C++14 | 710 ms | 13260 KB |

#include<bits/stdc++.h> using namespace std; #define rc(x) return cout<<x<<endl,0 #define pb push_back #define dbg(x) cout << #x << '=' << x << '\n'; #define ll long long #define int ll #define sz size() #define x first #define y second #define pi pair <int, int> #define pii pair <int, pi> #define vi vector <int> const ll mod = 1e9 + 7; int n, d[200002], a[200002], q, s, t; int temp(int x){ if(x>0) return s*x*(-1); else return t*abs(x); } int32_t main(){ ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cin>>n>>q>>s>>t; for(int i=0; i<=n; i++) cin>>a[i]; for(int i=1; i<=n; i++) d[i]=a[i]-a[i-1]; int ans=0; for(int i=1; i<=n; i++) ans+=temp(d[i]); ///cout<<ans; while(q--){ int l, r, x; cin>>l>>r>>x; ans+=(temp(d[l]+x)-temp(d[l])); if(r+1<=n) ans+=(temp(d[r+1]-x)-temp(d[r+1])); d[l]+=x; if(r+1<=n) d[r+1]-=x; cout<<ans<<endl; } }

# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|

1 | Correct | 8 ms | 376 KB | Output is correct |

2 | Correct | 8 ms | 376 KB | Output is correct |

3 | Correct | 8 ms | 376 KB | Output is correct |

4 | Correct | 8 ms | 248 KB | Output is correct |

5 | Correct | 8 ms | 376 KB | Output is correct |

6 | Correct | 8 ms | 376 KB | Output is correct |

7 | Correct | 8 ms | 376 KB | Output is correct |

8 | Correct | 8 ms | 376 KB | Output is correct |

9 | Correct | 8 ms | 376 KB | Output is correct |

10 | Correct | 8 ms | 380 KB | Output is correct |

11 | Correct | 8 ms | 376 KB | Output is correct |

12 | Correct | 8 ms | 376 KB | Output is correct |

13 | Correct | 8 ms | 376 KB | Output is correct |

14 | Correct | 8 ms | 376 KB | Output is correct |

15 | Correct | 8 ms | 376 KB | Output is correct |

16 | Correct | 11 ms | 376 KB | Output is correct |

17 | Correct | 9 ms | 504 KB | Output is correct |

18 | Correct | 8 ms | 376 KB | Output is correct |

19 | Correct | 2 ms | 376 KB | Output is correct |

20 | Correct | 2 ms | 380 KB | Output is correct |

21 | Correct | 2 ms | 380 KB | Output is correct |

# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|

1 | Correct | 658 ms | 5032 KB | Output is correct |

2 | Correct | 659 ms | 5748 KB | Output is correct |

3 | Correct | 668 ms | 6368 KB | Output is correct |

4 | Correct | 659 ms | 11000 KB | Output is correct |

5 | Correct | 669 ms | 12244 KB | Output is correct |

6 | Correct | 634 ms | 11260 KB | Output is correct |

7 | Correct | 640 ms | 11116 KB | Output is correct |

8 | Correct | 666 ms | 12012 KB | Output is correct |

9 | Correct | 669 ms | 12280 KB | Output is correct |

10 | Correct | 706 ms | 11000 KB | Output is correct |

11 | Correct | 642 ms | 11068 KB | Output is correct |

12 | Correct | 632 ms | 11768 KB | Output is correct |

13 | Correct | 630 ms | 12004 KB | Output is correct |

# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|

1 | Correct | 8 ms | 376 KB | Output is correct |

2 | Correct | 8 ms | 376 KB | Output is correct |

3 | Correct | 8 ms | 376 KB | Output is correct |

4 | Correct | 8 ms | 248 KB | Output is correct |

5 | Correct | 8 ms | 376 KB | Output is correct |

6 | Correct | 8 ms | 376 KB | Output is correct |

7 | Correct | 8 ms | 376 KB | Output is correct |

8 | Correct | 8 ms | 376 KB | Output is correct |

9 | Correct | 8 ms | 376 KB | Output is correct |

10 | Correct | 8 ms | 380 KB | Output is correct |

11 | Correct | 8 ms | 376 KB | Output is correct |

12 | Correct | 8 ms | 376 KB | Output is correct |

13 | Correct | 8 ms | 376 KB | Output is correct |

14 | Correct | 8 ms | 376 KB | Output is correct |

15 | Correct | 8 ms | 376 KB | Output is correct |

16 | Correct | 11 ms | 376 KB | Output is correct |

17 | Correct | 9 ms | 504 KB | Output is correct |

18 | Correct | 8 ms | 376 KB | Output is correct |

19 | Correct | 2 ms | 376 KB | Output is correct |

20 | Correct | 2 ms | 380 KB | Output is correct |

21 | Correct | 2 ms | 380 KB | Output is correct |

22 | Correct | 658 ms | 5032 KB | Output is correct |

23 | Correct | 659 ms | 5748 KB | Output is correct |

24 | Correct | 668 ms | 6368 KB | Output is correct |

25 | Correct | 659 ms | 11000 KB | Output is correct |

26 | Correct | 669 ms | 12244 KB | Output is correct |

27 | Correct | 634 ms | 11260 KB | Output is correct |

28 | Correct | 640 ms | 11116 KB | Output is correct |

29 | Correct | 666 ms | 12012 KB | Output is correct |

30 | Correct | 669 ms | 12280 KB | Output is correct |

31 | Correct | 706 ms | 11000 KB | Output is correct |

32 | Correct | 642 ms | 11068 KB | Output is correct |

33 | Correct | 632 ms | 11768 KB | Output is correct |

34 | Correct | 630 ms | 12004 KB | Output is correct |

35 | Correct | 674 ms | 10536 KB | Output is correct |

36 | Correct | 682 ms | 11896 KB | Output is correct |

37 | Correct | 671 ms | 12768 KB | Output is correct |

38 | Correct | 681 ms | 12408 KB | Output is correct |

39 | Correct | 689 ms | 12560 KB | Output is correct |

40 | Correct | 667 ms | 12536 KB | Output is correct |

41 | Correct | 671 ms | 12536 KB | Output is correct |

42 | Correct | 669 ms | 12460 KB | Output is correct |

43 | Correct | 672 ms | 11768 KB | Output is correct |

44 | Correct | 710 ms | 12236 KB | Output is correct |

45 | Correct | 669 ms | 12340 KB | Output is correct |

46 | Correct | 669 ms | 13260 KB | Output is correct |

47 | Correct | 632 ms | 11872 KB | Output is correct |

48 | Correct | 638 ms | 11768 KB | Output is correct |

49 | Correct | 651 ms | 10744 KB | Output is correct |

50 | Correct | 642 ms | 11588 KB | Output is correct |

51 | Correct | 631 ms | 11860 KB | Output is correct |

52 | Correct | 633 ms | 11888 KB | Output is correct |