View Code of Problem 3928

#include<stdio.h>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<map>
#include<vector>
using namespace std;
int p[10001];
int main()

{int happy, happ2;
	while(cin>>happy>>happ2){
memset(p, 0, sizeof(p));
	p[happy]++;
	p[happ2]++;
	
	for (int i = 1; i < 6; i++) {
		int y, yc;
		cin >> y >> yc;
		p[y]++;
		p[yc]++;
	}
	int flag = 1;
	for (int i = 0; i <= 10001; i++) {
		if (p[i] > 0 && p[i] < 4) {
			flag = 0;
		}
	}
	if (flag == 1) {
		cout << "POSSIBLE" << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
}
	return 0;
}

Double click to view unformatted code.


Back to problem 3928