# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
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
# | 결과 | 실행 시간 | 메모리 | 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 |