http://www.lydsy.com/JudgeOnline/problem.php?id=3916
#include <bits/stdc++.h>using namespace Std;int N, ans[3]; Char s[2000005];void work (int. now) {int l=1, r=n-(n>>1), if (now<2) ++r; int flag=0;//printf ("%d\n", now); for (int I=0, tot=n>>1; i<tot; ++i) {if (S[l]!=s[r]) {//printf ("%d%d\n", L, R); if (now==0 | | flag) {ans[now]=0; return;} if (now==1) ans[now]=l, ++l;if (now==2) ans[now]=r, ++r;flag=1;--i; Continue;} ++l; ++r;} if (!flag) ans[now]=n-(n>>1);} BOOL Check (int x, int y) {if (ans[x]==0 | | ans[y]==0 | | ans[x]==ans[y]) return 1; return 0;} int main () {scanf ("%d%s", &n, S+1), if ((n&1) ==0) {puts ("not POSSIBLE"); return 0;} for (int i=0, i<3; ++i) work (i), if (!ans[0] &&!ans[1] &&!ans[2]) {puts ("not POSSIBLE"); return 0;} for (int i=0; i<3; ++i) for (int. j=0; j<3; ++j) if (i!=j &&!check (i, J)) {puts ("not UNIQUE"); return 0;} int pos=0;for (int i=0; i<3; ++i) if (Ans[i]) pos=ans[i]; for (int. i=0; i<3; ++i) printf ("%d\n", Ans[i]), for (int i=1, cnt=0; i<=n; ++i) {if (I==pos) Continue;putchar (s[i]); if (++cnt== (n>>1)) break;} return 0;}
Obviously you can enumerate this point and then hash it around = =
However, this may be a card + constant large.
We consider 3 cases = This point is to the left of the midpoint, to the midpoint, to the right of the midpoint.
Then calculate the answer to these three cases = = then line spicy = = (for example, if on the left, then we allow the left side of the wrong character when sweeping
"Bzoj" 3916: [Baltic2014]friends