Submission #1540307
Source Code Expand
#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 //#define READ_FROM_FILE int main() { ios::sync_with_stdio(false); #ifdef READ_FROM_FILE 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 | |
---|---|
Task | A - Ice Tea Store |
User | cryptomanic |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1665 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 3 ms | 384 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |
sample_04.txt | AC | 1 ms | 256 KB |
subtask_1_01.txt | AC | 1 ms | 256 KB |
subtask_1_02.txt | AC | 1 ms | 256 KB |
subtask_1_03.txt | AC | 1 ms | 256 KB |
subtask_1_04.txt | AC | 1 ms | 256 KB |
subtask_1_05.txt | AC | 1 ms | 256 KB |
subtask_1_06.txt | AC | 1 ms | 256 KB |
subtask_1_07.txt | AC | 1 ms | 256 KB |
subtask_1_08.txt | AC | 1 ms | 256 KB |
subtask_1_09.txt | AC | 1 ms | 256 KB |
subtask_1_10.txt | AC | 1 ms | 256 KB |
subtask_1_11.txt | AC | 1 ms | 256 KB |
subtask_1_12.txt | AC | 1 ms | 256 KB |
subtask_1_13.txt | AC | 1 ms | 256 KB |
subtask_1_14.txt | AC | 1 ms | 256 KB |
subtask_1_15.txt | AC | 1 ms | 256 KB |