It works correctly for judge's input.

But... is it correct in general for arbitrary n and if so, how to prove that?

Here is how I compute for case m = 4 (there are also two similar cases for m=6, and all others are "Not found."):

Code: Select all

```
if (m == 4 && (n % 5) == 2) {
a = (n - 2) / 5;
printf("%d %d %d %d\n",
a,
2 * a,
4 * a + 1,
3 * a + 1
);
} else if (m == 4 && (n % 5) == 3) {
a = (n - 3) / 5;
printf("%d %d %d %d\n",
a,
3 * a + 1,
4 * a + 2,
2 * a + 1
);
...
```