Wrong Answer
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:26:38
- Judged At
- 2025-01-02 15:26:38
- Judged By
- Score
- 0
- Total Time
- 11ms
- Peak Memory
- 284.0 KiB