QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#558781 | #8932. Bingo | Yarema# | WA | 0ms | 3616kb | C++20 | 1.1kb | 2024-09-11 18:30:47 | 2024-09-11 18:30:47 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef double db;
template<typename T>
void updMin(T& a, T b)
{
a = min(a, b);
}
void solve()
{
int n;
cin >> n;
VI dp(n + 1, n), ndp(n + 1);
dp[0] = 0;
int cntB = 0;
FOR(i, 0, n)
{
ndp.assign(n + 1, n);
char c;
cin >> c;
if (c == 'B')
{
cntB++;
ndp[0] = dp[0] + 1;
FOR(j, 1, n + 1)
updMin(ndp[j - 1], dp[j]);
}
else
{
int a, b;
cin >> a >> b;
FOR(j, 0, n + 1)
{
updMin(ndp[j], max(0, dp[j] - a));
updMin(ndp[min(n, j + b)], dp[j]);
}
}
dp = ndp;
}
cout << 2 * cntB - *min_element(ALL(dp)) << "\n";
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3616kb
input:
6 7 3 12 3 9 10 249 51 1369 37 2 1
output:
0 0 0 0 0 0
result:
wrong answer 1st lines differ - expected: '9', found: '0'