Submission #67208017
Source Code Expand
Copy
#include <stdio.h>#include <stdlib.h>int main(void) {int N;int* D;int i, j;if (scanf("%d", &N) != 1) return 1;D = malloc(sizeof(*D) * N);if (D == NULL) return 2;D[0] = 0;for (i = 1; i < N; i++) {if (scanf("%d", &D[i]) != 1) return 1;D[i] += D[i - 1];}for (i = 0; i < N - 1; i++) {for (j = i + 1; j < N; j++) {printf(" %d" + (j == i + 1), D[j] - D[i]);}putchar('\n');}
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int N;
int* D;
int i, j;
if (scanf("%d", &N) != 1) return 1;
D = malloc(sizeof(*D) * N);
if (D == NULL) return 2;
D[0] = 0;
for (i = 1; i < N; i++) {
if (scanf("%d", &D[i]) != 1) return 1;
D[i] += D[i - 1];
}
for (i = 0; i < N - 1; i++) {
for (j = i + 1; j < N; j++) {
printf(" %d" + (j == i + 1), D[j] - D[i]);
}
putchar('\n');
}
free(D);
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Distance Table |
| User | mikecat |
| Language | C (gcc 12.2.0) |
| Score | 200 |
| Code Size | 460 Byte |
| Status | AC |
| Exec Time | 1 ms |
| Memory | 1756 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt, example_01.txt |
| All | example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 1 ms | 1648 KiB |
| example_01.txt | AC | 1 ms | 1648 KiB |
| hand_00.txt | AC | 0 ms | 1652 KiB |
| hand_01.txt | AC | 0 ms | 1656 KiB |
| hand_02.txt | AC | 0 ms | 1728 KiB |
| hand_03.txt | AC | 1 ms | 1628 KiB |
| hand_04.txt | AC | 1 ms | 1732 KiB |
| random_00.txt | AC | 1 ms | 1724 KiB |
| random_01.txt | AC | 0 ms | 1644 KiB |
| random_02.txt | AC | 1 ms | 1604 KiB |
| random_03.txt | AC | 1 ms | 1756 KiB |
| random_04.txt | AC | 0 ms | 1576 KiB |
| random_05.txt | AC | 1 ms | 1652 KiB |
| random_06.txt | AC | 1 ms | 1712 KiB |
| random_07.txt | AC | 0 ms | 1644 KiB |
| random_08.txt | AC | 0 ms | 1636 KiB |
| random_09.txt | AC | 0 ms | 1600 KiB |