Advertisement
Guest User

Yandex.Algorithm2017, warmup, B

a guest
Apr 22nd, 2017
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.81 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <iostream>
  4. #include <sstream>
  5. #include <fstream>
  6. #include <iomanip>
  7. #include <cstdio>
  8.  
  9. //#include <cstdint>
  10. //#include <cstdlib>
  11. #include <cassert>
  12. //#include <cctype>
  13. #include <climits>
  14. #include <functional>
  15. #include <numeric>
  16. #include <algorithm>
  17. #include <cmath>
  18. #include <ctime>
  19.  
  20. #include <string>
  21. #include <cstring>
  22. #include <vector>
  23. #include <set>
  24. #include <map>
  25. #include <stack>
  26. #include <queue>
  27. #include <list>
  28. #include <deque>
  29. #include <unordered_set>
  30. #include <unordered_map>
  31. #include <bitset>
  32. #include <array>
  33.  
  34. using namespace std;
  35.  
  36. #define forn(i, n) for(int i = 0; i < int(n); i++)
  37. #define forn1(i, n) for(int i = 1; i <= int(n); i++)
  38. #define sz(a) int((a).size())
  39. #define all(a) (a).begin(), (a).end()
  40. #define mp make_pair
  41. #define pb push_back
  42. #define x first
  43. #define y second
  44.  
  45. typedef long long li;
  46. typedef long double ld;
  47. typedef pair<int, int> pt;
  48.  
  49. const int INF = int(1e9);
  50. const li INF64 = li(1e18);
  51. const ld PI = acosl(ld(-1));
  52. const ld EPS = 1e-9;
  53.  
  54. template <typename T> inline T sqr(const T& x) {
  55.     return x * x;
  56. }
  57.  
  58. template <typename T> inline T abs(const T& x) {
  59.     return x > 0 ? x : -x;
  60. }
  61.  
  62. inline bool inside(int x, int y, int n, int m) {
  63.     return x >= 1 && x <= n && y >= 1 && y <= m;
  64. }
  65.  
  66. inline int rnd() {
  67.     return abs(rand() ^ (rand() << 15));
  68. }
  69.  
  70. inline int rnd(int n) {
  71.     assert(n > 0);
  72.     return rnd() % n;
  73. }
  74.  
  75. inline int rnd(int lf, int rg) {
  76.     return lf + rnd(rg - lf + 1);
  77. }
  78.  
  79. inline li rndLL() {
  80.     return rnd() * 1LL * rnd() + rnd();
  81. }
  82.  
  83. const int dx[4] = { -1, 0, +1, 0 };
  84. const int dy[4] = { 0, +1, 0, -1 };
  85.  
  86. const int dx8[8] = { -1, -1, 0, +1, +1, +1, 0, -1 };
  87. const int dy8[8] = { 0, +1, +1, +1, 0, -1, -1, -1 };
  88.  
  89. const int N = int(1e6) + 555;
  90.  
  91. int n, a[N];
  92.  
  93. inline void gen() {
  94.     return;
  95. }
  96.  
  97. inline bool read() {
  98.     forn(i, 4) assert(cin >> a[i]);
  99.     return true;
  100. }
  101.  
  102. inline void solve() {
  103.     sort(a, a + n);
  104.     assert(a[0]);
  105.     int cnt = 0;
  106.     /*
  107.     forn(i, 4) {
  108.         li sum = 0;
  109.         forn(j, 4) if (i != j) sum += a[j];
  110.         if (a[i] >= sum) {
  111.             puts("No");
  112.             return;
  113.         }
  114.     }
  115.     */
  116.  
  117.     if (a[0] + a[3] == a[1] + a[2]) puts("Yes");
  118.     else puts("No");
  119.     return;
  120. }
  121.  
  122. int main() {
  123.     //assert(false);
  124. #ifdef _DEBUG
  125.     assert(freopen("input.txt", "rt", stdin));
  126.     assert(freopen("output.txt", "wt", stdout));
  127. #endif
  128.  
  129.     cout << setprecision(10) << fixed;
  130.     cerr << setprecision(10) << fixed;
  131.  
  132.     srand(int(time(NULL)));
  133.  
  134.     int T = 1;
  135.     //#define MULTITEST
  136. #ifdef MULTITEST
  137.     assert(scanf("%d", &T) == 1);
  138. #endif
  139.  
  140.     forn(i, T) {
  141. #ifdef _DEBUG
  142.         cerr << "TEST == " << i << endl;
  143. #endif
  144.         assert(read());
  145.         //read();
  146.         //cout << "Case #" << i + 1 << ": ";
  147.         solve();
  148.         //cerr << "curTime == " << clock() << " ms" << endl;
  149.     }
  150.  
  151. #ifdef _DEBUG
  152.     cerr << "TIME == " << clock() << " ms" << endl;
  153. #endif
  154.     return 0;
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement