| Task: | Cent saving |
| Sender: | Oispa Kaljaa |
| Submission time: | 2016-05-28 14:25:11 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.06 s | details |
| #2 | WRONG ANSWER | 0.06 s | details |
Code
#include <bits/stdc++.h>
#define i64 long long
using namespace std;
int main(){
cin.sync_with_stdio(0);
cin.tie(0);
int tests; cin >> tests;
i64 p[101010];
while(tests--){
int n; cin >> n;
i64 sum = 0;
for(int i = 0; i < n; i++){
cin >> p[i];
if(p[i]%5 < 3)
sum+=p[i]-(p[i]%5);
else
sum+=p[i]+(5-p[i]%5);
}
i64 c[5] = {0};
for(int i = 0; i < n; i++)
c[p[i]%5]++;
i64 be = 0;
i64 m34 = min(c[3], c[4]);
be = max(be, m34*5+(c[3]-m34)/2*5+(c[4]-m34)/2*5);
be = max(be, c[3]/2*5+c[4]/2*5+(((c[3]&1) & (c[4]&1))*5));
cout << sum-be << endl;
}
return 0;
}
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 100 1000 528433894 255789530 559301042 ... |
| correct output |
|---|
| 475191144965 460688647850 478543444030 475238936090 456736521510 ... |
| user output |
|---|
| 475191144950 460688647840 478543444010 475238936090 456736521500 ... Truncated |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 1 100000 666086355 190481330 514353517 ... |
| correct output |
|---|
| 47176864928795 |
| user output |
|---|
| 47176864928575 |
