# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
904063 | rainboy | Shifty Grid (CCO17_shifty) | C11 | 9 ms | 1636 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>
#define N 100
#define M 100
#define K (N * M * 4 + 1)
int aa[N][M], ii[N * M], jj[N * M], n, m;
int tt[K], hh[K], dd[K], k;
void rotate(int i1, int j1, int i2, int j2, int cw) {
int di, dj, a, b, c;
di = (i2 - i1 + n) % n, dj = (j2 - j1 + m) % m;
if (cw) {
tt[k] = 2, hh[k] = j1, dd[k] = n - di, k++;
tt[k] = 1, hh[k] = i1, dd[k] = m - dj, k++;
tt[k] = 2, hh[k] = j1, dd[k] = di, k++;
tt[k] = 1, hh[k] = i1, dd[k] = dj, k++;
a = aa[i1][j1], b = aa[i1][j2], c = aa[i2][j1];
aa[i1][j1] = c, ii[c] = i1, jj[c] = j1;
aa[i1][j2] = a, ii[a] = i1, jj[a] = j2;
aa[i2][j1] = b, ii[b] = i2, jj[b] = j1;
} else {
tt[k] = 1, hh[k] = i1, dd[k] = m - dj, k++;
tt[k] = 2, hh[k] = j1, dd[k] = n - di, k++;
tt[k] = 1, hh[k] = i1, dd[k] = dj, k++;
tt[k] = 2, hh[k] = j1, dd[k] = di, k++;
a = aa[i1][j1], b = aa[i1][j2], c = aa[i2][j1];
aa[i1][j1] = b, ii[b] = i1, jj[b] = j1;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |