Test instructions and Analysis
A very pit water problem. The analysis woke up and mended.
Code
#include <bits/stdc++.h> #define MP make_pair#define PB emplace_back#define fi first#define se second#define ZERO (x ) memset ((x), 0, sizeof (x)) #define ALL (x) (x). Begin (), (x). End () #define REP (I, A, b) for (Reptype i = (a); I <= (b); ++i ) #define PER (I, a, b) for (Reptype i = (a); I >= (b); i) #define Quickio Ios::sync_with_stdio (FAL SE); Cin.tie (0); Cout.tie (0); using namespace std;using ll=long long;using reptype=int;int Main () {string A; cin>>a; int Len=a.leng Th (); if (len<4) cout<< "NO" <<endl; else {vector<int> ab,ba; Rep (i,0,len-2) {if (a[i]== ' a ' && a[i+1]== ' B ') ab. PB (i); else if (a[i]== ' B ' && a[i+1]== ' a ') Ba. PB (i); } bool Ok=false; Rep (I,0,int (Ab.size ())-1) {per (J,int (Ba.size ()) -1,0) {if (Ab[i]+1<len & ;& Ab[i]+1!=ba[j] && (ba[j]+1>len-1 | | ba[j]+1!=ab[i]) {ok=true; break;} } if (OK) break; } if (OK) cout<< "YES" <<endl; else cout<< "NO" <<endl; } return 0;}
Daily training "two substrings (codeforces Round 306 Div.2 A)