Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <stdio.h>
- #include <vector>
- #include <cmath>
- #include <string.h>
- #include <iostream>
- #include <algorithm>
- #include <string>
- using namespace std;
- int main()
- {
- vector <int> w(6);
- vector <int> h(6);
- vector <vector <int> > same(10000,vector<int> (10000));
- vector <int> amount(10000,0);
- for (int i =0;i<6;++i) {
- cin>> w[i]>>h[i];
- same[w[i]][h[i]]++;
- same[h[i]][w[i]]++;
- amount[w[i]]=w[i];
- amount[h[i]]=h[i];
- }
- int result=0;
- for (int i =0;i<amount.size();++i) {
- if (amount[i]!=0) result++;
- }
- if (result == 1) {
- cout << "POSSIBLE";
- return 0;
- }
- if (result >3) {
- cout << "IMPOSSIBLE";
- return 0;
- }
- bool pr=true;
- if (result ==3) {
- for (int i =0;i<6;++i) {
- if (same[w[i]][h[i]]!=2)
- pr=false;
- }
- if (pr) cout << "POSSIBLE"; else cout << "IMPOSSIBLE";
- return 0;
- }
- int p=0;
- if (result ==2) {
- for (int i=0; i<6;++i) {
- if (same[w[i]][h[i]]==4)
- p++;
- if (same[w[i]][h[i]]==2) p++;
- }
- if (p==2) cout << "POSSIBLE"; else cout << "IMPOSSIBLE";
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement