Submission #19723445


Source Code Expand

Copy
#include <bits/stdc++.h>
#include <atcoder/all>
#include <string.h>
#include <stdio.h>
using namespace std;
using namespace atcoder;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define nl <<endl
#define cy cout<<"Yes" nl
#define cn cout<<"No" nl
#define co(x) cout<<x nl
#define lp(i,a,b) for(i=a;i<b;i++)
#define lpe(i,a,b) for(i=a;i<=b;i++)

int main(){
    int a,b,x,y;
    int ans=0;
    cin>>a>>b>>x>>y;
    if(a==b){
        ans=x;
    }else if(a>b){
        ans=min(x+(a-b)*y,((a-b)*2-1)*x);
    }else{
        ans=min(x+(b-a)*y,(1+2*(b-a))*x);
    }
    cout<<ans nl;
    return 0;
}

Submission Info

Submission Time
Task A - Hands
User mun
Language C++ (GCC 9.2.1)
Score 0
Code Size 789 Byte
Status WA
Exec Time 8 ms
Memory 3668 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 11
WA × 1
Set Name Test Cases
Sample sample.txt, sample_2.txt, sample_3.txt
All 18_18_40_79.txt, 18_18_40_81.txt, 1_100_100_100.txt, 1_100_33_65.txt, 1_100_33_67.txt, 1_100_50_100.txt, 1_100_99_99.txt, 77_7_25_49.txt, 77_7_25_51.txt, sample.txt, sample_2.txt, sample_3.txt
Case Name Status Exec Time Memory
18_18_40_79.txt AC 8 ms 3612 KB
18_18_40_81.txt AC 2 ms 3476 KB
1_100_100_100.txt AC 2 ms 3616 KB
1_100_33_65.txt AC 5 ms 3668 KB
1_100_33_67.txt AC 3 ms 3452 KB
1_100_50_100.txt AC 3 ms 3564 KB
1_100_99_99.txt AC 3 ms 3632 KB
77_7_25_49.txt WA 3 ms 3532 KB
77_7_25_51.txt AC 3 ms 3640 KB
sample.txt AC 2 ms 3532 KB
sample_2.txt AC 4 ms 3564 KB
sample_3.txt AC 3 ms 3528 KB