Submission #3423878


Source Code Expand

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

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

#define FOR(k,a,b) for(int k=(a); k<=(b); ++k)
#define IFOR(k,a,b) for(int k=(a); k>=(b); --k)
#define REP(k,a) for(int k=0; k<(a);++k)
#define IREP(k,a) for(int k=a-1; k>=(0);--k)
#define SZ(a) int((a).size())
#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define x first
#define y second
#define INF 1000000001
#define INFLONG 1000000000000000000
#define MOD 1000000007
#define MAX 100
#define ITERS 100
#define MAXM 200000
#define MAXN 1000000
#define PI 3.1415926535897932384626
#define ERR -987654321
#define MEM(a,b) memset(a,b,sizeof(a));
#define read1(a) scanf("%d",&a)
#define read2(a,b) scanf("%d%d",&a,&b)
#define read3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define readl1(a) scanf("%lld",&a)
#define readl2(a,b) scanf("%lld%lld",&a,&b)
#define readl3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int rn = uniform_int_distribution<int>(0, MAXN)(rng);

    int a, b, c, x, y;
    cin>>a>>b>>c>>x>>y;
    int res = INF;

    REP(i,max(2*x, 2*y)+1) {
        int p = x - i/2;
        int q = y - i/2;
        if(p < 0) p = 0;
        if(q < 0) q = 0;
        res = min(res, i*c + p*a + q*b);
    }
    cout<<res;
    return 0;
}




Submission Info

Submission Time
Task C - Half and Half
User alokpatra1998
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1659 Byte
Status AC
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15
Case Name Status Exec Time Memory
a01 AC 1 ms 256 KB
a02 AC 1 ms 256 KB
a03 AC 2 ms 256 KB
b04 AC 1 ms 256 KB
b05 AC 2 ms 256 KB
b06 AC 2 ms 256 KB
b07 AC 2 ms 256 KB
b08 AC 2 ms 256 KB
b09 AC 2 ms 256 KB
b10 AC 2 ms 256 KB
b11 AC 1 ms 256 KB
b12 AC 2 ms 256 KB
b13 AC 1 ms 256 KB
b14 AC 2 ms 256 KB
b15 AC 2 ms 256 KB