Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
void solve() {
int n; cin >> n;
int cnt[3] = {};
while (n--) {
int x; cin >> x;
cnt[x % 3]++;
}
if (cnt[1] > cnt[2])
swap(cnt[1], cnt[2]);
cout << cnt[0] + cnt[1] + (cnt[2] - cnt[1]) - (cnt[2] - cnt[1]) % 3 << "\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t; cin >> t; while (t--)
solve();
}
Information
- Submit By
- Type
- Submission
- Problem
- P1013 F. Divisible by 3
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-07-14 18:24:14
- Judged At
- 2025-07-14 18:24:14
- Judged By
- Score
- 10
- Total Time
- 3ms
- Peak Memory
- 532.0 KiB