Submission

Status:

[PP][PP][P][P][P][P][P][P][P][P]

Subtask/Task Score:

{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}{10/10}

Score: 100

User: anonymous

Problemset: โรงงานหุ่นยนต์

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-25 21:52:00

#include <bits/stdc++.h>
using namespace std;

int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int h1,h2,b1,b2,x,y,ans =0;
    cin >> h1 >> h2 >> b1 >> b2 >> x >> y;

    for(int i=0;i <= min(h1,b1);i++){
        for(int j=0;j <= min(h2,b2);j++){
            ans = max(ans, min(i + j , x) + min(min(h1 - i, b2 - j) + min(h2 - j,b1 - i) , y));
        }
    }
    cout << ans;

}