2018 Multi-University, HDU Day 2

D. Game

solved by CSL. 0:13(+)

E. Hack It

solved by CSL. 3:51(+4)

for (int i = 0; i < p; i++)
    for (int j = 0; j < p; j++)
        for (int k = 0, t = j; k < p; k++, (t += i) %= p)
        {
            int x = i * p + j;
            int y = k * p + t;
            if (x < N && y < N) a[x][y] = 1;
        }

H. Naive Operations

solved by ybmj. 1:47(+)

J. Swaps and Inversions

solved by ybmj. 0:36(+1)