/ SeriousOJ /

Record Detail

Wrong Answer


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

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] + 2*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:26:15
Judged At
2025-07-14 18:26:15
Judged By
Score
10
Total Time
2ms
Peak Memory
532.0 KiB