nq1s788

24

Jun 10th, 2026
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. s = open('24_23762.txt').readline()
  2. n = len(s)
  3. l = 0
  4. r = 0
  5. cnt_2025 = 0
  6. if s[0] == 'Y':
  7.     cnt_y = 1
  8. else:
  9.     cnt_y = 0
  10. answ = 0
  11. while r + 1 < n:
  12.     r += 1
  13.     if s[r] == 'Y':
  14.         cnt_y += 1
  15.     if r - l + 1 >= 4 and s[r - 3:r + 1] == '2025':
  16.         cnt_2025 += 1
  17.     if cnt_y > 80:
  18.         while s[l] != 'Y':
  19.             if r - l + 1 >= 4 and s[l:l + 4] == '2025':
  20.                 cnt_2025 -= 1
  21.             l += 1
  22.         l += 1
  23.         cnt_y -= 1
  24.     if cnt_y == 80 and cnt_2025 >= 90:
  25.         answ = max(answ, r - l + 1)
  26. print(answ)
Advertisement
Add Comment
Please, Sign In to add comment