0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-26 23:51:58 +00:00
OI-codes/Codeforces/1605/B/B.cpp

33 lines
697 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
int t, n;
string s;
int main() {
cin >> t;
while (t--) {
cin >> n >> s;
if (is_sorted(s.begin(), s.end())) {
cout << 0 << endl;
continue;
}
int cnt = count(s.begin(), s.end(), '1');
s = ' ' + s;
vector<int> ans;
for (int i = 1; i <= n; i++) {
if (i < n - cnt + 1 && s[i] == '1' || i >= n - cnt + 1 && s[i] == '0') {
ans.push_back(i);
}
}
cout << 1 << endl;
cout << ans.size() << ' ';
for (int i : ans) {
cout << i << ' ';
}
cout << endl;
}
return 0;
}