标签:pac str printf div main sort include family span
#include <bits/stdc++.h> //#include "fp.h" using namespace std; int bk[10010]; int c[20]; struct node { int x,y; }a[10]; bool cmp(node aa,node b) { return aa.x==b.x?aa.y>b.y:aa.x>b.x; } bool check(int aa) { if(a[aa].x==a[aa+1].x&&a[aa].y==a[aa+1].y) return true; else return false; } main() { //fop(); while(cin>>a[0].x>>a[0].y>>a[1].x>>a[1].y>>a[2].x>>a[2].y>>a[3].x>>a[3].y>>a[4].x>>a[4].y>>a[5].x>>a[5].y) { memset(bk,0,sizeof(bk)); int k=0; for(int i=0;i<6;i++) { bk[a[i].x]++; bk[a[i].y]++; if(bk[a[i].x]==1) c[k++]=a[i].x; if(bk[a[i].y]==1) c[k++]=a[i].y; } int ff=1; for(int i=0;i<k;i++) if(bk[c[i]]%4!=0) { ff=0;break; } for(int i=0;i<6;i++) if(a[i].x<a[i].y) { int t; t=a[i].x; a[i].x=a[i].y; a[i].y=t; } sort(a,a+6,cmp); int f=1; for(int i=0;i<5;i+=2) if(!check(i)) { f=0; break; } printf("%s\n",(f&&ff)?"POSSIBLE":"IMPOSSIBLE"); } }
标签:pac str printf div main sort include family span
原文地址:https://www.cnblogs.com/baccano-acmer/p/9741159.html