UVa 11498 Division of Nlogonia (Water ver.)

Source: Internet
Author: User
Tags time limit

11498-division of Nlogonia

Time limit:1.000 seconds

Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem &problem=2493

The Problem

After centuries of hostilities and skirmishes between the Four nations living into the land generally known as Nlogonia, and Years of negotiations involving diplomats, politicians and the armed forces of all interested, with parties by UN, NATO, G7 and SBC, it was in last agreed by all the way to end of dispute, dividing the land into four independent ter Ritories.

It was agreed this one point, called Division Point, with coordinates established in the negotiations, would define the CO Untry Division, in the following way. Two lines, both containing the division point, one on the North-south direction and one in the east-west direction, would Be drawn on the map and dividing the land into four new countries. Starting from the Western-most, Northern-most Quadrant, in clockwise direction, the new countries'll be called Northwest Ern Nlogonia, northeastern Nlogonia, southeastern Nlogonia and southwestern Nlogonia.

The UN determined that "a page in the" Internet should exist so this inhabitants could check in which of the countries T Heir homes are. You are have been hired to help implementing the system.

The Input

The input contains several test cases. The A test case contains one integer K indicating the number of queries that would be made (0 < k≤103). The second line of "a test case" contains two integers Nand M representing the coordinates of the division point ( -104 < N, M < 104). Each of the K following lines contains two integers X and Y representing the coordinates of a residence ( -104≤x, y≤104 ).

The end of the input was indicated by a line containing only the number zero.

The Output

For each test case in the input your program must print one line containing:

The word divisa (means border in Portuguese) if the residence are on one of the border lines (North-south or east-west);

NO (means NW in Portuguese) if the residence was in northwestern Nlogonia;

NE if the residence is in northeastern Nlogonia;

SE if the residence is in southeastern Nlogonia;

So (means SW-Portuguese) if the residence is in southwestern Nlogonia.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.