CSES - Leirikisa 9.12.2021 - Results
Submission details
Task:Omenat
Sender:lain
Submission time:2021-12-09 13:35:04 +0200
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:30:10: error: expected ';' before 'mods'
   ans ++ mods[2] / 3;
          ^~~~

Code

#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n;
cin >> n;
ll mods[3];
mods[0]=mods[1]=mods[2] = 0;
for (int i = 0; i < n; ++i) {
int t;
cin >> t;
mods[t % 3]++;
}
ll ans = mods[0];
ll mn = min(mods[1], mods[2]);
ans += 2*mn;
mods[1] -= mn;
mods[2] -= mn;
ans += mods[1] / 3;
ans ++ mods[2] / 3;
cout << ans << '\n';
}