# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
498139 | Nalrimet | Growing Vegetable is Fun 3 (JOI19_ho_t3) | C++17 | 0 ms | 0 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;
#define int long long
const int inf = 1e9;
const int N = 405;
char a;
int n, r, g, y, rp[N], gp[N], yp[N], rpref[N], gpref[N], ypref[N];
vector<vector<vector<vector<int>>>> dp;
main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1; i <= n; ++i){
cin >> a;
rpref[i] += rpref[i - 1]
gpref[i] += gpref[i - 1];
ypref[i] += ypref[i - 1];
if(a == 'R') {rp[++r] = i; rpref[i]++;}
if(a == 'G') {gp[++g] = i; gpref[i]++;}
if(a == 'Y') {yp[++y] = i; ypref[i]++;}
}
if(max({r, g, y}) > (n + 1) / 2){