Submission #1869442


Source Code Expand

#include <iostream>
#include <vector>
#include <algorithm>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;
using std::lower_bound;
using std::upper_bound;
using std::find_if;
using std::copy;
using std::copy_if;

int a,b,c,d,e,f;


int main(){
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> f;
    a*=100;
    b*=100;

    int water=0;
    int sugar=0;

    for(int i=0; a*i<=f; i++){
        for(int j=0; a*i+b*j<=f; j++){
            int x=a*i+b*j;
            for(int k=0; c*k<=f; k++){
                for(int l=0; c*k+d*l<=f; l++){
                    int y=c*k+d*l;
                    if(x+y>f || x*e < 100*y){
                        continue;
                    }
                    if(sugar*x<=y*water){
                        water=x;
                        sugar=y;
                    }
                }
            }
        }
    }

    cout << (water+sugar) << " " << sugar << endl;
    return 0;
}

Submission Info

Submission Time
Task C - Sugar Water
User aznyn
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1087 Byte
Status AC
Exec Time 9 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 12
Set Name Test Cases
Sample subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
Case Name Status Exec Time Memory
01.txt AC 1 ms 256 KB
02.txt AC 2 ms 256 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 1 ms 256 KB
06.txt AC 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 256 KB
09.txt AC 1 ms 256 KB
subtask0_0.txt AC 1 ms 256 KB
subtask0_1.txt AC 9 ms 256 KB
subtask0_2.txt AC 1 ms 256 KB