| Task: | Cent saving |
| Sender: | Oispa Kaljaa |
| Submission time: | 2016-05-28 14:06:41 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.05 s | details |
| #2 | WRONG ANSWER | 0.06 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.sync_with_stdio(0);
cin.tie(0);
int tests; cin >> tests;
int p[101010];
while(tests--){
int n; cin >> n;
int 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);
}
//cout << "aluks " << sum << endl;
int c[5] = {0};
for(int i = 0; i < n; i++)
c[p[i]%5]++;
int mi34 = min(c[3], c[4]);
sum-=5*mi34;
//cout << "mi34 " << mi34 << " nyt " << sum << endl;
c[3]-=mi34;
c[4]-=mi34;
sum-=(c[4]/3)*5;
c[4]-=c[4]/3;
//cout << "lop4 " << sum << endl;
sum-=(c[3]/2)*5;
c[3]-=c[3]/2;
//cout << "lop3 " << sum << endl;
cout << sum << 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 |
|---|
| -1550224891 1127147178 1802074174 -1502433766 1469988134 ... Truncated |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 1 100000 666086355 190481330 514353517 ... |
| correct output |
|---|
| 47176864928795 |
| user output |
|---|
| 944149531 |
