10.28
思路:
模拟题,枚举向那个点靠拢。
显然只用考虑一种颜色算就好了。
每次向i号点靠拢,前一部分的点靠前,后一部分的点靠后。
然后模拟递推就好了。
这种拆环为链的题一般都要扩倍。
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define LL long long
#define N 1000010
using namespace std;
int len;
char s[N];
int a[N], cnt, num;
L