Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef pair<int, int> ii;
- #define fi first
- #define se second
- ii a[3];
- int main() {
- cin.tie(0)->sync_with_stdio(0);
- cin >> a[0].fi >> a[0].se;
- cin >> a[1].fi >> a[1].se;
- cin >> a[2].fi >> a[2].se;
- bool ok = false;
- vector<int> v({0, 1, 2});
- do {
- vector<int> u = v;
- for (int i : {0, 1}) {
- for (int j : {0, 1}) {
- for (int k : {0, 1}) {
- if (i) swap(a[u[0]].fi, a[u[0]].se);
- if (j) swap(a[u[1]].fi, a[u[1]].se);
- if (k) swap(a[u[2]].fi, a[u[2]].se);
- if (a[u[0]].fi + a[u[1]].fi == a[u[2]].se and
- a[u[0]].se == a[u[1]].se and
- a[u[2]].se == a[u[2]].fi+a[u[1]].se) {
- ok = true;
- }
- if (i) swap(a[u[0]].fi, a[u[0]].se);
- if (j) swap(a[u[1]].fi, a[u[1]].se);
- if (k) swap(a[u[2]].fi, a[u[2]].se);
- if (ok) break;
- }
- if (ok) break;
- }
- if (ok) break;
- }
- if (ok) break;
- } while(next_permutation(v.begin(), v.end()));
- cout << (ok ? "YES\n" : "NO\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment