# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
441667 | 2021-07-05T18:03:55 Z | rainboy | Prosjecni (COCI16_prosjecni) | C | 2 ms | 332 KB |
#include <stdio.h> int main() { int n, i, j, a; scanf("%d", &n); if (n <= 2) { printf(n == 1 ? "1\n" : "-1\n"); return 0; } a = n * (n - 1) / 2 + 1; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) printf("%d ", (i < n - 1 ? i + 1 : a - 1) * a + (j < n - 1 ? j + 1 : a - 1)); printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 272 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 332 KB | Output is correct |
9 | Correct | 2 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |