Contest Duration: ~ (local time) (150 minutes) Back to Home

Submission #1540307

Source Code Expand

Copy
```#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007

int main() {
ios::sync_with_stdio(false);
freopen("input.in","r",stdin);
freopen("output.out","w",stdout);
#endif

vector<ll> cost(4);
vector<pair<ll, ll>> A(4);

ll N;
rep(i, 4) {
cin>>cost[i];
A[i] = make_pair(cost[i]*(8/pow(2, i)), i);
}
cin>>N;

sort(A.begin(), A.end());

int i = 0;
if(A[i].second == 0) {
cout<<4LL*N*cost[0]<<endl;
return 0;
}

if(A[i].second == 1) {
cout<<2LL*N*cost[1]<<endl;
return 0;
}

if(A[i].second == 2) {
cout<<N*cost[2]<<endl;
return 0;
}

if(N%2 == 0) {
cout<<(N/2)*cost[3]<<endl;
return 0;
}

ll ans = (N/2)*cost[3];
N = 1;

i = 1;
if(A[i].second == 0) {
cout<<ans+4LL*N*cost[0]<<endl;
return 0;
}

if(A[i].second == 1) {
cout<<ans+2LL*N*cost[1]<<endl;
return 0;
}

if(A[i].second == 2) {
cout<<ans+N*cost[2]<<endl;
return 0;
}

return 0;
}
```

#### Submission Info

Submission Time 2017-08-26 21:20:21+0900 A - Ice Tea Store cryptomanic C++14 (GCC 5.4.1) 300 1665 Byte AC 3 ms 384 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
sample_01.txt 3 ms 384 KB
sample_02.txt 1 ms 256 KB
sample_03.txt 1 ms 256 KB
sample_04.txt 1 ms 256 KB