Submission #19396264


Source Code Expand

Copy
#include <bits/stdc++.h>
#include <stdlib.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-7;

#define _GLIBCXX_DEBUG
#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

void Add(ll &a, ll b){a=(a+b)%mod;}
void Mul(ll &a, ll b) {a=(a*b)%mod;}
void coutP(P x) {cout<<x.first<<' '<<x.second<<endl;}


int main(){
    ll A,B,C,D,E,F; cin>>A>>B>>C>>D>>E>>F;
    vector<bool> water(31,false);
    water[0]=true;
    REP(i,1,31){
        if(i-A>=0 && water[i-A]) water[i]=true;
        if(i-B>=0 && water[i-B]) water[i]=true;
    }
    vector<bool> sugar(3001,false);
    sugar[0]=true;
    REP(i,1,3001){
        if(i-C>=0 && sugar[i-C]) sugar[i]=true;
        if(i-D>=0 && sugar[i-D]) sugar[i]=true;
    }
    vec d;
    double memo=-1;
    P ans=mp(-1,-1);
    rep(i,3001) if(sugar[i]) d.pb(i);
    REP(i,1,31) if(water[i]){
        if(i*100>F) break;
        ll risou=min(F-100*i,i*E);
        
        ll K=d[upper_bound(ALL(d),risou)-d.begin()-1];
        if((double)K/i>memo) {
            memo=(double)K/i;
            ans=mp(i*100+K,K);
        }
    }
    coutP(ans);
}

Submission Info

Submission Time
Task C - Sugar Water
User Jazztarou
Language C++ (GCC 9.2.1)
Score 300
Code Size 1758 Byte
Status AC
Exec Time 9 ms
Memory 3668 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 9 ms 3576 KB
02.txt AC 2 ms 3524 KB
03.txt AC 2 ms 3516 KB
04.txt AC 2 ms 3592 KB
05.txt AC 2 ms 3664 KB
06.txt AC 2 ms 3668 KB
07.txt AC 2 ms 3588 KB
08.txt AC 4 ms 3620 KB
09.txt AC 3 ms 3644 KB
subtask0_0.txt AC 4 ms 3548 KB
subtask0_1.txt AC 2 ms 3484 KB
subtask0_2.txt AC 2 ms 3516 KB