Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这是个大水!

Posted by KatrineYang at 2016-09-03 00:51:39 on Problem 1262
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	int T;
	scanf("%d", &T);
	for(int ii = 0; ii < T; ii++){
		int x, y;
		scanf("%d%d", &x, &y);
		int xl[110], yl[110], xh[110], yh[110];
		int gs;
		scanf("%d", &gs);
		bool inside = 1;
		bool disjoint = 1;
		long long int area = 0;
		for(int i = 0; i < gs; i++){
			scanf("%d%d%d%d", &xl[i], &yl[i], &xh[i], &yh[i]);
			if(xl[i]<0 || yl[i]<0 || xh[i]>x || yh[i]>y) inside = 0;
			area += (xh[i]-xl[i])*(yh[i]-yl[i]);
		}
		for(int i = 0; i < gs-1; i++){
			for(int j = i+1; j < gs; j++){
				if(xh[i]>xl[j] && xh[j]>xl[i] && yh[i]>yl[j] && yh[j]>yl[i]){
					disjoint = 0;
					goto done;
				}
			}
		}
		done:
		if(!disjoint){
			printf("NONDISJOINT\n");
		}
		else if(!inside){
			printf("NONCONTAINED\n");
		}
		else if(area != x*y){
			printf("NONCOVERING\n");
		}
		else{
			printf("OK\n");
		}
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator