题解:CF2065E Skibidus and Rizz
thedyingkai_ · · 题解
思路
由题意,平衡值为
由于题目要求的是全部子串的最大平衡值等于
题目要求
但是继续拼接
最后输出三个循环范围的来源:
-
-
-
### AC code ```cpp #include "iostream" #include "algorithm" using namespace std; int t,n,m,k; int main(){ cin>>t; while(t--){ cin>>n>>m>>k; bool flag=0; if(n<m){ swap(n,m); flag=1; } if(k>n||k<n-m){ cout<<"-1\n"; continue; } for(int i=0;i<k;i++) cout<<(0^flag); for(int i=0;i<n-k;i++) cout<<(1^flag)<<(0^flag); for(int i=0;i<m-n+k;i++) cout<<(1^flag); cout<<'\n'; } } ```