# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28589 | not good but never sad (#68) | Test Data Creation (FXCUP2_testdata) | C++98 | 0 ms | 952 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 <stdio.h>
int N, M, S[300*300][601], T[300*300];
bool wh[300*300][601], mv[300*300][601], ans[300*300];
void upd(int i, int k, int t, bool w, bool m)
{
if (S[i][k] == -1 || S[i][k] > t){
S[i][k] = t;
wh[i][k] = w;
mv[i][k] = m;
}
}
int main()
{
scanf("%d %d", &M, &N);
for (int i=0;i<N*M;i++) scanf("%d", &T[i]);
for (int i=0;i<N*M;i++) for (int k=0;k<=600;k++) S[i][k] = -1;
S[0][300] = T[0];
for (int i=0;i<N*M;i++){
int xp = i / M, yp = i % M;
for (int k=0;k<=600;k++) if (S[i][k] != -1){
if (k >= 300){
if (xp + 1 < N) upd(i+M,k-M,S[i][k]+(k-M!=300?T[i+M]:0),0,0);
if (yp + 1 < M) upd(i+1,k-1,S[i][k]+(k-1!=300?T[i+1]:0),0,1);
}
else{
int xq = (i + k - 300) / N, yq = (i + k - 300) % N;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |