/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 40ms 544.0 KiB
#3 Wrong Answer 40ms 556.0 KiB

Code

/*
 *   Copyright (c) 2025 Emon Thakur
 *   All rights reserved.
 */
#include<bits/stdc++.h>
using namespace std;
void solve()
{
    int n; cin >> n;
    int x,zero=0,one=0,minus=0;
    for(int i=0;i<n;i++)
    {
        cin >> x;
        zero += (x==0);
        one += (x==1);
        minus += (x<0);
    }
    x = min(one , minus/2);
    int ans = x;
    one -= x;
    minus -= x*2;
    x = one/3;
    ans += x;
    one -= x*3;
    if(one == 2 && minus>2*zero) --ans;
    cout<<ans<<endl;
}
int main()
{
    int t; cin>> t; while(t--) solve();
}

Information

Submit By
Type
Submission
Problem
P1152 Special Array
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-05 13:11:00
Judged At
2025-01-05 13:11:00
Judged By
Score
1
Total Time
40ms
Peak Memory
556.0 KiB