orazma

b.cpp

May 4th, 2026
38
0
Never
7
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 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.  
  17. void solve(){
  18.  
  19.     int n;
  20.     ll s;
  21.     cin >> n >> s;
  22.     int a[n + 1];
  23.  
  24.     for (int i = 1; i <= n; i++){
  25.         cin >> a[i];
  26.     }
  27.     int right = 0;
  28.     ll sum = 0;
  29.     int ans = 0;
  30.     for (int left = 1; left <= n; left++){
  31.         while(right < n && sum <= s){
  32.             right++;
  33.             sum += a[right];
  34.         }
  35.  
  36.         if (sum > s){
  37.             ans = max(ans, right - left);
  38.         }
  39.         else{
  40.             ans = max(ans, right - left + 1);
  41.         }
  42.         sum -= a[left];
  43.     }
  44.  
  45.     cout << ans;
  46.  
  47.  
  48.  
  49. }
  50.  
  51. int main() {
  52.     IOS;
  53.     int t = 1;
  54.     //cin >> t;
  55.     while(t--){
  56.         solve();
  57.     }
  58.     return 0;
  59. }
  60.  
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