# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961367 | TAhmed33 | Netrpeljivost (COI23_netrpeljivost) | C++98 | 1501 ms | 79336 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;
typedef long long ll;
int n, a[2049][2049];
const ll inf = 1e18;
void chmin (ll &x, ll y) {
if (x > y) x = y;
}
vector <vector <ll>> recurse (int l, int r) {
if (l == r - 1) {
vector <vector <ll>> dp(2, vector <ll> (2, inf));
dp[0][1] = dp[1][0] = a[l][r];
return dp;
}
int sze = r - l + 1;
vector <vector <ll>> dp(sze, vector <ll> (sze, inf));
sze >>= 1;
int mid = (l + r) >> 1;
auto g = recurse(l, mid), h = recurse(1 + mid, r);
for (int i = 0; i < sze; i++) {
for (int j = 0; j < sze; j++) {
ll mn = inf;
for (int k = 0; k < sze; k++) {
chmin(mn, g[i][k] + a[k + l][j + mid + 1]);
}
for (int k = 0; k < sze; k++) {
chmin(dp[i][k + sze], mn + h[k][j]);
}
}
}
# | 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... |