Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: jamesz

Problemset: เดินทางไกล

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-20 18:31:27

#include<iostream>
using namespace std;
int main(){
	int n,s,d,type;
	cin>>n;
	cin>>s;
	int max,low;
	max = 0;
	low = 0;
	for(int i = 0; i<n; i++){
		cin>>d;
		if(d%3 == 0 && d%4 != 0){
			type = 1;
		}
		else if(d%4 == 0 && d%3 != 0){
			type = 2;
		}
		
		if(type == 1){
			s = s-(2*5*(d/3.0));
		}
		else if(type == 2){
			s = s-(2*5*(d/4.0));
		}
		else{
			low += (2*5*(d/3.0));
			max += (2*5*(d/4.0));
		}
		type = 0;
		
	}
	cout<<s-low<<" "<<s-max;
}