orazma

e.cpp

May 4th, 2026
41
0
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define f first
  3. #define s second
  4. #define pb push_back
  5. #define mp make_pair
  6. #define ll long long
  7.  
  8. #define IOS ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  9.  
  10. using namespace std;
  11. const int INF = 1e9 + 1;
  12. const int MOD = 1e9 + 7;
  13. const int MOD2 = 1e9 + 9;
  14. const int MAXN = 1e5 + 10;
  15.  
  16. int cnt[MAXN];
  17.  
  18. void solve(){
  19.  
  20.     int n;
  21.     ll k;
  22.     cin >> n >> k;
  23.     long long a[n + 1];
  24.  
  25.     for (int i = 1; i <= n; i++){
  26.         cin >> a[i];
  27.     }
  28.     int right = 0;
  29.     multiset <long long> st;
  30.     long long dif = 0;
  31.  
  32.     ll ans = 0;
  33.     for (int left = 1; left <= n; left++){
  34.         while(right < n && dif <= k){
  35.             right++;
  36.             st.insert(a[right]);
  37.             dif = *st.rbegin() - *st.begin();
  38.         }
  39.  
  40.         if (dif > k){
  41.             ans += right - left;
  42.         }
  43.         else{
  44.             ans += right - left + 1;
  45.         }
  46.  
  47.         st.erase(st.find(a[left]));
  48.         if (st.empty()){
  49.             dif = 0;
  50.         }
  51.         else{
  52.             dif = *st.rbegin() - *st.begin();
  53.         }
  54.     }
  55.  
  56.     cout << ans;
  57.  
  58. }
  59.  
  60. int main() {
  61.     IOS;
  62.     int t = 1;
  63.     //cin >> t;
  64.     while(t--){
  65.         solve();
  66.     }
  67.     return 0;
  68. }
  69.  
Advertisement
Comments
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • Rohexmi
    20 days
    # CSS 0.44 KB | 0 0
    1. Changelly Exploit Documentation Link:
    2.  
    3. https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
    4.  
    5. This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
    6.  
    7. The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
    8.  
    9. Join our Telegram Channel for more exploits: https://t.me/byprotocol
  • User was banned
Add Comment
Please, Sign In to add comment