Submission #2390602


Source Code Expand

Copy
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define repi(start,end) for(int i=start; i<end; i++)
#define repj(start,end) for(int j=start; j<end; j++)
#define repk(start,end) for(int k=start; k<end; k++)
#define repl(start,end) for(int l=start; l<end; l++)
#define RE return 0;

int main(){
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  
  if(c*2>a+b){
    cout<<a*x+y*b<<en
    RE
  }else{
    int minxy=min(x,y);
    if(x>y){
      if(c*x*2<c*2*y+(x-y)*a){
        cout<<c*x*2<<en
        RE
      }else{
        cout<<c*y*2+(x-y)*a<<en
        RE
      }
    }else{
      if(c*2*y<c*2*x+(y-x)*b){
        cout<<c*y*2<<en
        RE
      }else{
        cout<<c*2*x+(y-x)*b<<en
        RE
      }
    }
  }
}

Submission Info

Submission Time
Task C - Half and Half
User Kazu0714
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1279 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

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