Problem - 1678B2 - Codeforces
因为所有字段都必须是偶数,所以很自然的将i与i+1(i=1,3,5,...)组合到一起,如果si != si+1 则两个字符中一定有一个要改变,也就是这个cell不能确定是0还是1。
不能确定的cell数即是需要op的数量,能确定的cell相邻不同的数量即是最后最小的数量
很好想,最难想的地方是每两个一组的构造
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<bitset>
#include<cmath>
#include<array>
#include<atomic>
#include<sstream>
#include<stack>
//#define int ll
#define pb push_back
#define endl '\n'
#define x first
#define y second
#define Endl endl
#define pre(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,b,a) for(int i=b;i>=a;i--)