/ SeriousOJ /

Record Detail

Compile Error

foo.c: In function 'main':
foo.c:9:18: error: 'MAX_N' undeclared (first use in this function)
    9 |         int N, A[MAX_N], B[MAX_N], C[MAX_N], SUM = 0;
      |                  ^~~~~
foo.c:9:18: note: each undeclared identifier is reported only once for each function it appears in

Code

#include <stdio.h>


int main() {
    int T;
    scanf("%d", &T);

    while (T--) {
        int N, A[MAX_N], B[MAX_N], C[MAX_N], SUM = 0;
        scanf("%d", &N);

        for (int i = 0; i < N; i++) scanf("%d", &A[i]);
        for (int i = 0; i < N; i++) scanf("%d", &B[i]);
        for (int i = 0; i < N; i++) scanf("%d", &C[i]);

        for (int i = 0; i < N; i++) {
            int currentSum = A[i] + B[i] + C[i];
            if (i > 0 && (A[i] == A[i - 1] || B[i] == B[i - 1] || C[i] == C[i - 1])) {
                if (i < N - 1) {
                    currentSum = A[i + 1] + B[i + 1] + C[i + 1];
                    i++;
                }
            }
            SUM += currentSum;
        }

        printf("%d\n", SUM);
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1046 Maximum sum in 3-array
Contest
TLE_Headquarters - round #1
Language
C99 (GCC 13.2.0)
Submit At
2024-03-27 16:46:57
Judged At
2024-11-11 03:38:06
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes