From 34eab0ae754e6cd4456fec215d635449793eb796 Mon Sep 17 00:00:00 2001 From: Jesus Wahrman <41008968+jesuswr@users.noreply.github.com> Date: Mon, 18 Oct 2021 21:31:42 -0400 Subject: [PATCH 1/2] Create 1110d.cpp --- codeforces/D/1110d.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 codeforces/D/1110d.cpp diff --git a/codeforces/D/1110d.cpp b/codeforces/D/1110d.cpp new file mode 100644 index 0000000..62c5e9c --- /dev/null +++ b/codeforces/D/1110d.cpp @@ -0,0 +1,80 @@ +// https://codeforces.com/contest/1110/problem/D +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +typedef long long ll; +typedef long double ld; +typedef pair pii; +typedef pair> piii; +typedef vector vi; +typedef vector vii; + +int dadsadasda; + +#define ri(a) dadsadasda=scanf("%d", &a) +#define rii(a,b) dadsadasda=scanf("%d %d", &a, &b) +#define riii(a,b,c) dadsadasda=scanf("%d %d %d", &a, &b, &c) +#define rl(a) dadsadasda=scanf("%lld", &a) +#define rll(a,b) dadsadasda=scanf("%lld %lld", &a, &b) +#define FOR(i,n,m) for(int i=n; im; i--) +#define pb push_back +#define lb lower_bound +#define ub upper_bound +#define F first +#define S second +#define ALL(s) s.begin(),s.end() +#define SZ(s) (int)s.size() + +const int INF = 0x3f3f3f3f; +const ll LLINF = 1e18; +const int MAXN = 1e6 + 30; // CAMBIAR ESTE +//mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); + +// GJNM +int N, M; +int CNT[MAXN]; + +int DP[MAXN][3][3]; +int f(int p, int t1, int t2) { + if (p == MAXN - 10) + return 0; + int &ret = DP[p][t1][t2]; + if (ret != -1) + return ret; + ret = -INF; + FOR(t3, 0, 3) { + int a = t1, b = t1 + t2, c = t1 + t2 + t3, d = t2 + t3, e = t3; + if (a > CNT[p - 1] || b > CNT[p] || c > CNT[p + 1] || d > CNT[p + 2] || e > CNT[p + 3]) + continue; + ret = max(ret, t1 + (CNT[p + 1] - c) / 3 + f(p + 1, t2, t3)); + } + return ret; +} + +int main() { + memset(DP, -1, sizeof(DP)); + rii(N, M); + FOR(i, 0, N) { + int a; ri(a); + CNT[a + 6]++; + } + int ans = 0; + printf("%d\n", ans + f(1, 0, 0)); + return 0; +} From 587ffd18b075c855550184f3bf687ecf7fa5c4f2 Mon Sep 17 00:00:00 2001 From: Jesus Wahrman <41008968+jesuswr@users.noreply.github.com> Date: Mon, 18 Oct 2021 21:31:58 -0400 Subject: [PATCH 2/2] Rename 1110d.cpp to 1110D.cpp --- codeforces/D/{1110d.cpp => 1110D.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename codeforces/D/{1110d.cpp => 1110D.cpp} (100%) diff --git a/codeforces/D/1110d.cpp b/codeforces/D/1110D.cpp similarity index 100% rename from codeforces/D/1110d.cpp rename to codeforces/D/1110D.cpp