Submission
Status:
[-S][-S][P][-][P][P][P][P][P][P]
Subtask/Task Score:
{0/10}{0/10}{10/10}{0/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}
Score: 70
User: SonnyHappy108
Problemset: โรงงานหุ่นยนต์
Language: cpp
Time: 0.002 second
Submitted On: 2026-04-11 13:24:19
#include <bits/stdc++.h>
using namespace std;
//done : 9
void manu(int &head,int &body,int &colpref,int &money){
int manum=min(min(head,body),colpref);
head-=manum;
body-=manum;
colpref-=manum;
money+=manum;
}
int main(){
int hb,hw,bb,bw,sc,dc;
int a[24];
cin >> hb >> hw >> bb >> bw >> sc >> dc;
int thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc,tm=0;
manu(thb,tbb,tsc,tm);//1
manu(thw,tbw,tsc,tm);//2
manu(thw,tbb,tdc,tm);//3
manu(thb,tbw,tdc,tm);//4
a[0]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbb,tsc,tm);//1
manu(thw,tbw,tsc,tm);//2
manu(thb,tbw,tdc,tm);//4
manu(thw,tbb,tdc,tm);//3
a[1]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbb,tsc,tm);//1
manu(thw,tbb,tdc,tm);//3
manu(thw,tbw,tsc,tm);//2
manu(thb,tbw,tdc,tm);//4
a[2]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbb,tsc,tm);//1
manu(thw,tbb,tdc,tm);//3
manu(thb,tbw,tdc,tm);//4
manu(thw,tbw,tsc,tm);//2
a[3]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbb,tsc,tm);//1
manu(thb,tbw,tdc,tm);//4
manu(thw,tbw,tsc,tm);//2
manu(thw,tbb,tdc,tm);//3
a[4]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbb,tsc,tm);//1
manu(thb,tbw,tdc,tm);//4
manu(thw,tbb,tdc,tm);//3
manu(thw,tbw,tsc,tm);//2
a[5]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbw,tsc,tm);//2
manu(thb,tbb,tsc,tm);//1
manu(thw,tbb,tdc,tm);//3
manu(thb,tbw,tdc,tm);//4
a[6]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbw,tsc,tm);//2
manu(thb,tbb,tsc,tm);//1
manu(thb,tbw,tdc,tm);//4
manu(thw,tbb,tdc,tm);//3
a[7]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbw,tsc,tm);//2
manu(thw,tbb,tdc,tm);//3
manu(thb,tbb,tsc,tm);//1
manu(thb,tbw,tdc,tm);//4
a[8]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbw,tsc,tm);//2
manu(thw,tbb,tdc,tm);//3
manu(thb,tbw,tdc,tm);//4
manu(thb,tbb,tsc,tm);//1
a[9]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbw,tsc,tm);//2
manu(thb,tbw,tdc,tm);//4
manu(thb,tbb,tsc,tm);//1
manu(thw,tbb,tdc,tm);//3
a[10]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbw,tsc,tm);//2
manu(thb,tbw,tdc,tm);//4
manu(thw,tbb,tdc,tm);//3
manu(thb,tbb,tsc,tm);//1
a[11]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbb,tdc,tm);//3
manu(thb,tbb,tsc,tm);//1
manu(thw,tbw,tsc,tm);//2
manu(thb,tbw,tdc,tm);//4
a[12]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbb,tdc,tm);//3
manu(thb,tbb,tsc,tm);//1
manu(thb,tbw,tdc,tm);//4
manu(thw,tbw,tsc,tm);//2
a[13]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbb,tdc,tm);//3
manu(thw,tbw,tsc,tm);//2
manu(thb,tbb,tsc,tm);//1
manu(thb,tbw,tdc,tm);//4
a[14]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbb,tdc,tm);//3
manu(thw,tbw,tsc,tm);//2
manu(thb,tbw,tdc,tm);//4
manu(thb,tbb,tsc,tm);//1
a[15]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbb,tdc,tm);//3
manu(thb,tbw,tdc,tm);//4
manu(thb,tbb,tsc,tm);//1
manu(thw,tbw,tsc,tm);//2
a[16]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thw,tbb,tdc,tm);//3
manu(thb,tbw,tdc,tm);//4
manu(thw,tbw,tsc,tm);//2
manu(thb,tbb,tsc,tm);//1
a[17]=tm;
tm=0;
manu(thb,tbw,tdc,tm);//4
manu(thb,tbb,tsc,tm);//1
manu(thw,tbw,tsc,tm);//2
manu(thw,tbb,tdc,tm);//3
a[18]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbw,tdc,tm);//4
manu(thb,tbb,tsc,tm);//1
manu(thw,tbb,tdc,tm);//3
manu(thw,tbw,tsc,tm);//2
a[19]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbw,tdc,tm);//4
manu(thw,tbw,tsc,tm);//2
manu(thb,tbb,tsc,tm);//1
manu(thw,tbb,tdc,tm);//3
a[20]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbw,tdc,tm);//4
manu(thw,tbw,tsc,tm);//2
manu(thw,tbb,tdc,tm);//3
manu(thb,tbb,tsc,tm);//1
a[21]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbw,tdc,tm);//4
manu(thw,tbb,tdc,tm);//3
manu(thb,tbb,tsc,tm);//1
manu(thw,tbw,tsc,tm);//2
a[22]=tm;
tm=0;
thb=hb,thw=hw,tbb=bb,tbw=bw,tsc=sc,tdc=dc;
manu(thb,tbw,tdc,tm);//4
manu(thw,tbb,tdc,tm);//3
manu(thw,tbw,tsc,tm);//2
manu(thb,tbb,tsc,tm);//1
a[23]=tm;
int maxmoney=a[0];
for(int i=1;i<24;i++){
if (a[i]>maxmoney){
maxmoney=a[i];
}
}
cout << maxmoney;
}