# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101718 | KCSC | Growing Vegetable is Fun 3 (JOI19_ho_t3) | C++14 | 170 ms | 163152 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 DIM = 405;
const int INF = 405 * 405;
char str[DIM];
int dp[DIM][DIM][DIM][3], idx[3];
int tot[3], psm[DIM][3], lst[DIM][3];
inline void f(int &x, int y) {
if (x >= y) { x = y; } }
int main(void) {
#ifdef HOME
freopen("vegetables.in", "r", stdin);
freopen("vegetables.out", "w", stdout);
#endif
int n; cin >> n >> (str + 1);
for (int i = 1; i <= n; ++i) {
char ch = str[i];
if (ch == 'R') { lst[++tot[0]][0] = i; ++psm[i][0]; }
if (ch == 'G') { lst[++tot[1]][1] = i; ++psm[i][1]; }
if (ch == 'Y') { lst[++tot[2]][2] = i; ++psm[i][2]; }
for (int l = 0; l <= 2; ++l) {
psm[i][l] += psm[i - 1][l]; } }
for (int a = 0; a <= tot[0]; ++a) {
for (int b = 0; b <= tot[1]; ++b) {
for (int c = 0; c <= tot[2]; ++c) {
for (int l = 0; l <= 2; ++l) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |