# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
288755 | luciocf | JJOOII 2 (JOI20_ho_t2) | C++14 | 218 ms | 217224 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e3+10;
const int inf = 1e9+10;
int n, k;
string a;
int dp[maxn][maxn][3];
int solve(int i, int j, int q)
{
if (q == 2 && j == k) return 0;
if (i == n) return inf;
if (dp[i][j][q] != -1) return dp[i][j][q];
int ans = inf;
if (q == 0 && j == 0) ans = min(ans, solve(i+1, 0, 0));
if (q == 0)
{
ans = min(ans, 1+solve(i+1, j, q));
if (a[i] == 'J')
{
if (j+1 < k) ans = min(ans, solve(i+1, j+1, q));
else ans = min(ans, solve(i+1, 0, 1));
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |