-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABearAndFiveCards.cpp
94 lines (77 loc) · 2.35 KB
/
ABearAndFiveCards.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
using namespace std;
#define printv(data) for(auto& e:data) cout<<e<<","; cout<<endl;
#define sortv(data) std::sort(data.begin(),data.end());
#define rsortv(data) std::sort(data.rbegin(),data.rend());
#define fori(start,end) for(size_t i{start};i<=end;i++)
#define forj(start,end) for(size_t j{start};j<=end;j++)
#define rofi(start,end) for(size_t i{start};i>end;i--)
#define foralli(data) fori(0,data.size())
using ll = long long;
using ld = long double;
using pll = std::pair<ll,ll>;
using vpll = std::vector<pll>;
using vll = std::vector<ll>;
constexpr ll BIGLL{ std::numeric_limits<ll>::max() };
constexpr ld BIGLD{ std::numeric_limits<ld>::max() };
constexpr ll LL10{ 10000000000 + 1 };
constexpr ld pi = 3.141592653589793238462643383279502884;
template<typename t,typename t2>
auto min(t&& a,t2&& b) -> decltype(a+b){ return a < b ? a : b; }
template<typename t,typename t2>
auto max(t&& a,t2&& b) -> decltype(a+b){ return a > b ? a : b; }
template<typename N>
N multimax_impl(N cur,N last)
{ return max(cur,last); }
template<typename N,typename...VALS>
N multimax_impl(N cur,N n,VALS...vals)
{ return multimax_impl(max(cur,n),vals...); }
template<typename N,typename...VALS>
N multimax(N f,VALS...values)
{ return multimax_impl(std::numeric_limits<N>::min(),f,values...); }
template<typename T>
T pow(T n,T e){
T r{1};
while(e--)
r*=n;
return r;
}
#define get(var_name) ll var_name{0}; cin >> var_name;
#define gets(var_name) std::string var_name; cin >> var_name;
#define readv(start,end,vec_name) std::vector<ll> vec_name(end); for(size_t i{start};i<end;i++) cin>>vec_name[i];
#define getpll(llp) std::cin>>llp.first>>llp.second;
//specific for codeforces
#ifndef ONLINE_JUDGE
#define Log(...) fprintf (stdout, __VA_ARGS__);
#define LogN(num) fprintf (stdout, "@: %l64d\n", num);
#define LogS(str) fpringf (stdout, "@: %s\n", str.c_str());
#else
#define Log(...)
#define LogN(num)
#define LogS(str)
#endif
int main()
{
ios_base::sync_with_stdio(false);
ll t;
map<ll,ll> data;
ll sum{0};
fori(1,5)
{
cin >> t;
sum += t;
++data[t];
}
ll ans{sum};
for(auto e:data){
if(e.second>=2){
ans = min(ans,sum-e.first*min(3,e.second));
}
}
cout<<ans<<endl;
return 0;
}