/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 0ms 320.0 KiB
#2 Wrong Answer 12ms 284.0 KiB

Code

#include<stdio.h>

int main() {
    int t;
    scanf("%d", &t);
    while(t--) {
        int n;
        scanf("%d", &n);
        
        int pos = 0, neg = 0, zero = 0;
        for(int i = 0; i < n; i++) {
            int ele;
            scanf("%d", &ele);
            if(ele == 1){
            pos++;}
            else if(ele == -1){
            neg++;}
            else if(ele == 0){ 
            zero++;}
        }

        int sum1 = pos / 3;
        pos %= 3;

        int sub = 0;
        while(pos > 0 && neg >= 2) {
            sub++;
            pos--;
            neg -= 2;
        }

        sub += neg / 3;

        int tscore = sum1 + sub;
        printf("%d\n", tscore);
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1152 Special Array
Contest
Happy New Year 2025
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-02 15:34:33
Judged At
2025-01-02 15:34:33
Judged By
Score
0
Total Time
12ms
Peak Memory
320.0 KiB