Code Submission Evaluation System Login

HIIT Open 2016

Start:2016-05-28 11:00:00
End:2016-05-28 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2016 - Results
History
2016-05-28 12:12:16
2016-05-28 12:11:29
Task:Cent saving
Sender:Game of Nolife
Submission time:2016-05-28 12:12:16
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.05 / 1.00details
#2ACCEPTED0.05 / 1.00details

Code

#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int tcs;
	cin>>tcs;
	for (int tc=0;tc<tcs;tc++) {
		int n;
		cin>>n;
		int cnt4=0;
		int cnt3=0;
		ll sum=0;
		for (int i=0;i<n;i++) {
			ll p;
			cin>>p;
			sum+=p-(p%5);
			if (p%5==3) cnt3++;
			if (p%5==4) cnt4++;
		}
		int parsa=501010;
		for (int i=0;2*i<=cnt3;i++) {
			int hlp=5*i;
			int asd=min(cnt3-2*i,cnt4);
			hlp+=5*asd;
			hlp+=((cnt4-asd)/3)*10;
			hlp+=(cnt3-2*i-asd)*5;
			hlp+=((cnt4-asd)%3)*5;
			parsa=min(parsa,hlp);
		}
		cout<<sum+parsa<<"\n";
	}
}

Test details

Test 1

Verdict: ACCEPTED

input
100
1000
528433894 255789530 559301042 ...
view   save

correct output
475191144965
460688647850
478543444030
475238936090
456736521510
477687545180
464978309415
469754811210
473772861015
459378192990
484964363025
469227939745
476076446280
463968012420
480317542525
458834989560
472694971870
467845191980
475238640235
470940911790
...
view   save

user output
475191144965
460688647850
478543444030
475238936090
456736521510
477687545180
464978309415
469754811210
473772861015
459378192990
484964363025
469227939745
476076446280
463968012420
480317542525
458834989560
472694971870
467845191980
475238640235
470940911790
...
view   save

Test 2

Verdict: ACCEPTED

input
1
100000
666086355 190481330 514353517 ...
view   save

correct output
47176864928795
view   save

user output
47176864928795
view   save