/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 560.0 KiB
#2 Wrong Answer 32ms 544.0 KiB
#3 Wrong Answer 32ms 564.0 KiB

Code

#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;

    while(t--)
    {
        int n;
        cin>>n;

        int A[n],count1=0,count2=0,count3=0;
        for(int i=0; i<n; i++)
        {
            cin>>A[i];

            if(A[i]== -1){
                count1++;
            }
            else if(A[i]== 0){
                count2++;
            }
            if(A[i]== 1){
                count3++;
            }
        }

        int scr=0;

        scr += (count1/3)*-1;
        count1 %=3;

        scr += (count3/3)*(1);
        count3 %=3;

        if(count1==2 && count3>=1){
            scr+=1;
        }

        cout<<scr<<endl;
    }
}

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:57:18
Judged At
2025-01-02 15:57:18
Judged By
Score
1
Total Time
32ms
Peak Memory
564.0 KiB