# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161159 | pr3pony | Growing Vegetable is Fun 3 (JOI19_ho_t3) | C++14 | 683 ms | 780392 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;
template<class T>
bool cmin(T & a,T b) {return b < a ? a = b, 1 : 0;}
const int N = 405;
char s[N];
int n;
int dp[N][N][N][3];
vector<int> d[3];
int pr[N][3];
int f(int i,array<int,3> a)
{
int s = 0;
for (int j = 0; j < 3; ++j)
s += max(0, pr[i][j] - a[j]);
return s - 1;
}
int main()
{
cin >> n >> (s + 1);
d[0] = d[1] = d[2] = {0};
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < 3; ++j) {
pr[i][j] += pr[i-1][j];
if ("RGY"[j] == s[i]) {
d[j].push_back(i);
pr[i][j]++;
}
}
}
Compilation message (stderr)
# | 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... |