ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1628. White Streaks

No subject
Posted by hess 11 Oct 2008 17:07
I cant undrestand how to count rectangles?
pleaze explain it.
Re: No subject
Posted by Nikolai Besschetnov 11 Oct 2008 22:48
Let me describe 2nd example of the task.
5 1 2
2 1
3 1
---
We will got this:
[ ]
[X]
[X]
[ ]
[ ]
There is 2 bars 'cause 1 square as well is bar. And it should be counted if it not contents into others longer bars.
For example:
----------
3 4 4
1 2
2 1
3 2
3 3
-----------
[ ][X][ ][ ]
[X][ ][ ][ ]
[ ][X][X][ ]
The right answer will be
horizontal: 1+1 = 2
vertical  : 1+1 = 2
single blocks: 1+1 = 2
Answer is 6.

How to build program?
Dont allocate all matrix into memory as i did :))) Sorry for this idiotizm :(

So u need to find out the optimal way. The program can be runed and exited with success with 300Kb of mem. I know this way, so i try to put the code here as fast as possible.
Re: No subject
Posted by Beksinski (ONPU) 12 Oct 2008 03:27
The problem statement is very ambigous and tricky. Don't like such problems... Program is very easy, but undestanding what is requested by the authors- isn't.

Thanks to Nikolai Besschetnov. Your sample saves me.