mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-10 16:38:48 +00:00
108 lines
2.3 KiB (Stored with Git LFS)
C++
108 lines
2.3 KiB (Stored with Git LFS)
C++
#include "testlib.h"
|
|
|
|
#include <bits/stdc++.h>
|
|
//#define _wa 0
|
|
//#define _ok 100
|
|
using namespace std;
|
|
|
|
const int MaxN = 1e5 + 5;
|
|
|
|
int n, bit[MaxN];
|
|
|
|
inline void bitModify(int x) {
|
|
for (; x <= n; x += x & -x)
|
|
++bit[x];
|
|
}
|
|
|
|
inline int bitQuery(int x) {
|
|
int res = 0;
|
|
for (; x; x ^= x & -x)
|
|
res += bit[x];
|
|
return res;
|
|
}
|
|
|
|
inline int segQuery(int l, int r) {
|
|
return bitQuery(r) - bitQuery(l - 1);
|
|
}
|
|
|
|
// void quitf(double score, string report) {
|
|
// cout << score;
|
|
// cerr << report;
|
|
// }
|
|
// ifstream fin, fout, fstd;
|
|
int main(int argc, char *argv[]) {
|
|
// registerLemonChecker(argc, argv);
|
|
registerTestlibCmd(argc, argv);
|
|
// fin.open("input");
|
|
// fout.open("user_out");
|
|
// fstd.open("answer");
|
|
|
|
n = inf.readInt();
|
|
int R = inf.readInt(), B = inf.readInt();
|
|
string a = inf.readToken();
|
|
// int R, B;
|
|
// string a;
|
|
// fin >> n >> R >> B;
|
|
// fin >> a;
|
|
string ansToken = ans.readToken("YES|NO");
|
|
string oufToken = ouf.readToken("YES|NO");
|
|
// string ansToken, oufToken;
|
|
// fout >> oufToken;
|
|
// fstd >> ansToken;
|
|
|
|
if (ansToken != oufToken) {
|
|
quitf(_wa, "The answer is %s, but you print %s.", ansToken.c_str(), oufToken.c_str());
|
|
return 0;
|
|
}
|
|
|
|
if (ansToken == "NO") {
|
|
quitf(_ok, "Accepted.");
|
|
return 0;
|
|
}
|
|
|
|
static bool vis[MaxN];
|
|
|
|
int cnt = ouf.readInt();
|
|
// int cnt;
|
|
// fout >> cnt;
|
|
for (int i = 1; i <= cnt; ++i) {
|
|
vector<int> pos;
|
|
int cntR = 0, cntB = 0;
|
|
|
|
for (int j = 1; j <= R + B; ++j) {
|
|
int x;
|
|
// fout >> x;
|
|
x = ouf.readInt();
|
|
pos.push_back(x);
|
|
|
|
if (vis[pos.back()]) {
|
|
quitf(_wa, "You print repeated numbers.");
|
|
return 0;
|
|
}
|
|
|
|
cntR += a[pos.back() - 1] == 'R';
|
|
cntB += a[pos.back() - 1] == 'B';
|
|
|
|
vis[pos.back()] = true;
|
|
}
|
|
|
|
if (cntR != R || cntB != B) {
|
|
quitf(_wa, "not satisfy limit (R, B)");
|
|
return 0;
|
|
}
|
|
|
|
std::sort(pos.begin(), pos.end());
|
|
|
|
if (segQuery(pos.front(), pos.back())) {
|
|
quitf(_wa, "Invalid positions.");
|
|
return 0;
|
|
}
|
|
|
|
for (int x : pos) bitModify(x);
|
|
}
|
|
|
|
quitf(_ok, "Accepted.");
|
|
|
|
return 0;
|
|
}
|