0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 20:28:48 +00:00

#945. 魔法(magic)

https://sjzezoj.com/submission/69384
This commit is contained in:
Baoshuo Ren 2023-02-12 14:50:43 +08:00
parent 9ef51c1399
commit 32016ef417
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
99 changed files with 364 additions and 0 deletions

70
S2OJ/945/945.cpp Normal file
View File

@ -0,0 +1,70 @@
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e5 + 5;
int n, r, b;
std::string s;
std::vector<std::pair<int, int>> st{{0, 0}};
std::vector<std::vector<int>> ans;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> r >> b >> s;
s = ' ' + s;
int cnt_r = std::count(s.begin(), s.end(), 'R'),
cnt_b = std::count(s.begin(), s.end(), 'B');
if ((n % (r + b)) || (!r && cnt_r) || (!b && cnt_b) || r && b && (cnt_r % r || cnt_b % b || cnt_r / r != cnt_b / b)) {
cout << "NO" << endl;
exit(EXIT_SUCCESS);
}
cout << "YES" << endl
<< n / (r + b) << endl;
// Hack: 9 1 2 RBBBRRBBB
//
// for (int i = 1; i <= n; i++) {
// if (i % (r + b) == 0) {
// cout << i << endl;
// } else {
// cout << i << ' ';
// }
// }
for (int i = 1; i <= n; i++) {
st.emplace_back(i, st.back().second + (s[i] == 'R'));
if (st.size() > r + b && st.back().second - st[st.size() - r - b - 1].second == r) {
std::vector<int> res;
std::for_each(st.end() - r - b, st.end(), [&](std::pair<int, int> x) { res.emplace_back(x.first); });
st.erase(st.end() - r - b, st.end());
ans.emplace_back(res);
}
}
std::reverse(ans.begin(), ans.end());
for (auto e : ans) {
for (int x : e) {
cout << x << ' ';
}
cout << endl;
}
return 0;
}

BIN
S2OJ/945/data/chk.cpp (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic11.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic12.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic13.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic14.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic15.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic16.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic17.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic18.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic19.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic20.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic21.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic21.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic22.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic22.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic23.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic23.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic24.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic24.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic25.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic25.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic26.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic26.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic27.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic27.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic28.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic28.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic29.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic29.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic30.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic30.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic31.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic31.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic32.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic32.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic33.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic33.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic34.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic34.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic35.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic35.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic36.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic36.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic37.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic37.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic38.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic38.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic39.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic39.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic40.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic40.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic41.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic41.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic42.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic42.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic43.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic43.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic44.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic44.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic45.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic45.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic46.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic46.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic47.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic47.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic48.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic48.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/magic9.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/945/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.