Submission #60587153
Source Code Expand
Copy
#include <stdio.h>#include <stdlib.h>int compare(const void *a, const void *b) {long long int_a = *(long long *)a;long long int_b = *(long long *)b;return (int_a > int_b) - (int_a < int_b);}int main() {int N;scanf("%d", &N);long long *X = (long long *)malloc(N * sizeof(long long));for (int i = 0; i < N; i++) {scanf("%lld", &X[i]);}for (int i = 0; i <= N - 4; i++) {long long M = (X[i] + X[i + 3]) / 2;X[i + 1] = 2 * M - X[i + 1];X[i + 2] = 2 * M - X[i + 2];
#include <stdio.h> #include <stdlib.h> int compare(const void *a, const void *b) { long long int_a = *(long long *)a; long long int_b = *(long long *)b; return (int_a > int_b) - (int_a < int_b); } int main() { int N; scanf("%d", &N); long long *X = (long long *)malloc(N * sizeof(long long)); for (int i = 0; i < N; i++) { scanf("%lld", &X[i]); } for (int i = 0; i <= N - 4; i++) { long long M = (X[i] + X[i + 3]) / 2; X[i + 1] = 2 * M - X[i + 1]; X[i + 2] = 2 * M - X[i + 2]; } long long sum = 0; for (int i = 0; i < N; i++) { sum += X[i]; } printf("%lld\n", sum); free(X); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Minimize Sum |
User | samra17864 |
Language | C (gcc 12.2.0) |
Score | 0 |
Code Size | 743 Byte |
Status | WA |
Exec Time | 29 ms |
Memory | 3100 KB |
Compile Error
Main.c: In function ‘main’: Main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &N); | ^~~~~~~~~~~~~~~ Main.c:15:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%lld", &X[i]); | ^~~~~~~~~~~~~~~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||
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, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.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, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_00.txt | WA | 0 ms | 1616 KB |
example_01.txt | WA | 1 ms | 1716 KB |
hand_00.txt | WA | 0 ms | 1628 KB |
hand_01.txt | WA | 13 ms | 3044 KB |
hand_02.txt | WA | 17 ms | 2892 KB |
hand_03.txt | WA | 16 ms | 3028 KB |
hand_04.txt | WA | 21 ms | 2900 KB |
hand_05.txt | WA | 18 ms | 3048 KB |
hand_06.txt | WA | 20 ms | 3008 KB |
hand_07.txt | WA | 21 ms | 3100 KB |
hand_08.txt | WA | 21 ms | 3036 KB |
hand_09.txt | WA | 20 ms | 3048 KB |
random_00.txt | WA | 11 ms | 2312 KB |
random_01.txt | WA | 1 ms | 1572 KB |
random_02.txt | WA | 19 ms | 2704 KB |
random_03.txt | WA | 1 ms | 1696 KB |
random_04.txt | WA | 22 ms | 2996 KB |
random_05.txt | WA | 22 ms | 3016 KB |
random_06.txt | WA | 1 ms | 1616 KB |
random_07.txt | WA | 29 ms | 3036 KB |
random_08.txt | WA | 0 ms | 1620 KB |
random_09.txt | WA | 12 ms | 2224 KB |
random_10.txt | WA | 22 ms | 2964 KB |
random_11.txt | WA | 22 ms | 2964 KB |
random_12.txt | WA | 11 ms | 2176 KB |
random_13.txt | WA | 15 ms | 2520 KB |
random_14.txt | WA | 0 ms | 1592 KB |
random_15.txt | WA | 0 ms | 1588 KB |
random_16.txt | WA | 21 ms | 3036 KB |
random_17.txt | WA | 0 ms | 1728 KB |
random_18.txt | WA | 21 ms | 3032 KB |
random_19.txt | WA | 21 ms | 3012 KB |