fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define file "o"
  5. #define ff(i, a, b) for(auto i=(a); i<=(b); ++i)
  6. #define ffr(i, b, a) for(auto i=(b); i>=(a); --i)
  7. #define nl "\n"
  8. #define ss " "
  9. #define pb emplace_back
  10. #define fi first
  11. #define se second
  12. #define sz(s) (int)s.size()
  13. #define all(s) (s).begin(), (s).end()
  14. #define ms(a,x) memset(a, x, sizeof (a))
  15. #define cn continue
  16. #define re exit(0)
  17.  
  18. typedef long long ll;
  19. typedef unsigned long long ull;
  20. typedef long double ld;
  21. typedef vector<int> vi;
  22. typedef vector<ll> vll;
  23. typedef pair<int, int> pii;
  24. typedef pair<ll, ll> pll;
  25. typedef vector<pii> vpii;
  26. typedef vector<pll> vpll;
  27.  
  28. mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
  29. ll ran(ll l, ll r)
  30. {
  31. return uniform_int_distribution<ll> (l, r)(rng);
  32. }
  33.  
  34. inline void rf()
  35. {
  36. ios_base::sync_with_stdio(false);
  37. cin.tie(nullptr); cout.tie(nullptr);
  38. if(fopen(file".inp","r"))
  39. {
  40. freopen(file".inp","r",stdin);
  41. freopen(file".out","w",stdout);
  42. }
  43. }
  44.  
  45. const int mod=1e9+7;
  46. const int maxn=2e5+15;
  47. const ll inf=1e16;
  48.  
  49. template<typename T> inline void add(T &x, const T &y)
  50. {
  51. x+=y;
  52. if(x>=mod) x-=mod;
  53. if(x<0) x+=mod;
  54. }
  55.  
  56. template<typename T> inline bool maxi(T &a, T b)
  57. {
  58. if(a>=b) return 0;
  59. a=b; return 1;
  60. }
  61.  
  62. template<typename T> inline bool mini(T &a, T b)
  63. {
  64. if(a<=b) return 0;
  65. a=b; return 1;
  66. }
  67.  
  68. int task, n;
  69. string s;
  70.  
  71. signed main()
  72. {
  73. rf();
  74. cin>>task>>s;
  75. n=sz(s); s=" "+s;
  76. if(task==1)
  77. {
  78. int c1=0, c2=0;
  79. ff(i, 1, n-3) if(s[i]=='2')
  80. {
  81. string tmp=s.substr(i, 4);
  82. cout<<tmp<<ss;
  83. if(tmp=="2025") ++c1;
  84. else if(tmp=="2026") ++c2;
  85. }
  86. if(c1>c2) cout<<"NO";
  87. else cout<<"YES";
  88. }
  89. re;
  90. }
  91.  
Success #stdin #stdout 0.01s 5316KB
stdin
1
20256
stdout
2025 NO