Compile Error
foo.cc:5:10: fatal error: debug.h: No such file or directory 5 | #include "debug.h" | ^~~~~~~~~ compilation terminated.
Code
#include <bits/stdc++.h>
using namespace std;
#include "debug.h"
void solve() {
int n;
cin >> n;
map<int, int> cnt;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
++cnt[x];
}
int a1 = min(cnt[1], cnt[-1] / 2);
cnt[1] -= a1;
cnt[-1] -= 2 * a1;
int a2 = cnt[1] / 3;
cnt[1] -= 3 * a2;
int a3 = min(cnt[-1], cnt[0]);
cnt[-1] -= min(cnt[-1], 2 * a3);
int a4 = cnt[-1] / 3;
cnt[-1] -= 3 * a4;
cout << a1 + a2 - (a4 + cnt[-1]) << '\n';
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int tc = 1;
cin >> tc;
while (tc--) {
solve();
}
}
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 14:45:41
- Judged At
- 2025-01-02 14:45:41
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes