All submissions for this problem are available.
A Wealthy Businessman wants to construct a hotel at the site of a small colony of people in South Joypur. For this task, he has assigned you to determine a definite set of buildings which can be razed to found the hotel, constraint to the condition that it must also have a desired area as well as other priorities, nice views from the rooms for one. Again, since you do not have access to the Housing Board Documents due to non-cooperation of the authorities, you are left with only one choice: to calculate the area by travelling around it and using the obtained circumference to the effect.
However, since there are many sets of buildings in the colony you need a device that can calculate the area enclosed in a loop as soon as the loop is complete, so you are saved from the headache of calculating the area again and again, and can focus on other priorities.
First line contains the number of test cases N (1<=N<=100)
Then follow N test cases, each of which is in the form of a string containing directions, concluded by #. Each test case may encompass more than one line. In case a loop is not complete, it should return "INCOMPLETE LOOP"
Output will contain the total areas covered by each of the loops, or, if the case may be, "INCOMPLETE LOOP"
Input: 3 E4N5w4S5# s13# e2n2w 5S3E3n1# Output: 20 INCOMPLETE LOOP 13
|Time Limit:||0.230769 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.