Submit  All submissions  Best solutions  Back to list 
RECTAREA  Homogeneous area 
Wersja polska  English version 
Given two rectangles You are to calculate the area they occupy.
Input
There is unknown number of tests. Each test consist of eight integers x_{A1} y_{A1} x_{A2} y_{A2} x_{B1} y_{B1} x_{B2} y_{B2} (all<=10^{6}).
Input ends when all numbers equal 0.
Output
For each test You should print the area these two rectangles occupy.
Example
Input: 6 4 9 9 5 5 10 10 10 5 5 10 9 9 6 4 0 0 0 0 0 0 0 0 Output: 28 28
Illustration to the 1st test
Special thanks to Rafał Spręga for the concept of this task.
Added by:  Piotr Ką kol 
Date:  20110122 
Time limit:  1.794s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: SCM qobi 
Resource:  Yet another SHORTEN task 
hide comments
20110626 23:28:22 Piotr KÄ…kol
@Jander  sorry, but why it's not obvious? I wrote that all are positive?  means absolute value. Did You have any doubts? 

20110626 16:11:22 Jander
Ah, ok  it's not clear from the info that the input can be ve. Okay, now to work on the fix :) Edit: I've seen the flaw. Now to work out a neat way around it. Last edit: 20110626 16:55:50 

20110626 15:47:33 Piotr KÄ…kol
@JAnder  You print wrong answers for negative numbers. Example: In: 662332 803342 267556 241124 999128 497146 418841 334500 Out: 642957095590 

20110626 15:33:04 Jander
@Piotr  Can you tell me why 5299215 gets WA ? 