#include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; struct S { int x, y; } s[6]; bool cmp(S a ,S b){ if(a.x == b.x) return a.y < b.y; else return a.x < b.x; } int main(void) { while (cin >> s[0].x >> s[0].y) { if (s[0].x > s[0].y) swap(s[0].x, s[0].y); for (int i = 1; i < 6; i++) { cin >> s[i].x >> s[i].y; if (s[i].x > s[i].y) swap(s[i].x, s[i].y); } sort(s, s + 6, cmp); int flag = 0; if(s[0].x == s[1].x && s[1].x == s[2].x && s[2].x == s[3].x && s[4].x == s[5].x && s[5].x == s[0].y){ if(s[0].y == s[1].y && s[2].y == s[3].y && s[4].y == s[5].y && s[3].y == s[4].y){ flag = 1; } } if(flag) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; } } |
Double click to view unformatted code.