# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
537948 | couplefire | Wombats (IOI13_wombats) | 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;
const int N = 5005;
const int M = 205;
const int MX = 1010;
const int INF = 0x3f3f3f3f;
int n, m, q;
int vert[N][M], hori[N][M], shori[N][M];
int seg[MX][M][M], best[M][M];
void calc(int f[M][M], int tl, int tr){
memset(f, INF, sizeof(int)*M*M);
for(int i = 1; i<=m; ++i)
for(int j = tl; j<=tr; ++j){
for(int k = 1; k<=m; ++k)
f[i][k] = (j==tl?abs(shori[tl][i]-shori[tl][k]):f[i][k]+vert[j-1][k]);
int lmn = f[i][1];
for(int k = 2; k<=m; ++k)
f[i][k] = min(f[i][k], lmn+shori[j][k]),
lmn = min(lmn, f[i][k]-shori[j][k]);
int rmn = f[i][m]+shori[j][m];
for(int k = m-1; k>=1; --k)
f[i][k] = min(f[i][k], rmn-shori[j][k]),
rmn = min(rmn, f[i][k]+shori[j][k]);
}
}
void comb(int f[M][M], int lf[M][M], int rf[M][M], int bruh[M]){