Wrong Answer
Code
#include <stdio.h>
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
int neg_ones = 0, zeros = 0, pos_ones = 0;
for (int i = 0; i < n; i++) {
int val;
scanf("%d", &val);
if (val == -1) {
neg_ones++;
} else if (val == 0) {
zeros++;
} else {
pos_ones++;
}
}
int score = 0;
while (neg_ones >= 1 && pos_ones >= 2) {
score += (-1) * 1 * 1;
neg_ones--;
pos_ones -= 2;
}
while (neg_ones >= 3) {
score += (-1) * (-1) * (-1);
neg_ones -= 3;
}
printf("%d\n", score);
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1152 Special Array
- Contest
- Happy New Year 2025
- Language
- C99 (GCC 13.2.0)
- Submit At
- 2025-01-02 15:51:02
- Judged At
- 2025-01-02 15:51:02
- Judged By
- Score
- 0
- Total Time
- 16ms
- Peak Memory
- 444.0 KiB