# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235789 | Haunted_Cpp | Raisins (IOI09_raisins) | C++17 | 1012 ms | 36344 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.
/**
* author: Duarte Nobrega
* created: 29.05.2020
**/
#include <bits/stdc++.h>
using namespace std;
const int N = 50 + 5;
typedef long long i64;
int g [N][N], s [N][N];
int dp [N][N][N][N];
int range_query (int x1, int y1, int x2, int y2) {
return s[x2][y2] - (x1 - 1 >= 0 ? s[x1 - 1][y2] : 0) - (y1 - 1 >= 0 ? s[x2][y1 - 1] : 0) + (x1 - 1 >= 0 && y1 - 1 >= 0 ? s[x1 - 1][y1 - 1] : 0);
}
int r, c;
int solve (int x1, int y1, int x2, int y2) {
if (x1 > x2) return 0;
if (y1 > y2) return 0;
if (x1 == x2 && y1 == y2) return 0;
int &res = dp[x1][y1][x2][y2];
if (~res) return res;
res = 1e9;
if (x1 != x2) {
for (int i = x1; i <= x2; i++) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |