/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 284.0 KiB
#2 Accepted 0ms 516.0 KiB
#3 Accepted 0ms 320.0 KiB
#4 Accepted 0ms 324.0 KiB
#5 Wrong Answer 0ms 344.0 KiB
#6 Wrong Answer 0ms 516.0 KiB

Code

#include <stdio.h>

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

    int arr[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }
 
    if (arr[0] % 2 != 0) {
        printf("-1\n"); 
    } else {
        int count = 1; 

       
        for (int i = 1; i < n; i++) {
            if (arr[i] % 2 != 0 && arr[i - 1] % 2 != 0) {
                continue;
            }
            count++;
        }

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

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1042 Array partition
Contest
TLE_Headquarters - round #1
Language
C99 (GCC 13.2.0)
Submit At
2024-03-27 17:55:34
Judged At
2024-11-11 03:37:22
Judged By
Score
25
Total Time
0ms
Peak Memory
516.0 KiB