<PREV Problem:
NEXT>
Solved by 183 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Picture segments

Time limit = 3

Input is BMP-file.

Your program should count number of segments in the picture. Segment is connected domain of unique colored pixels. Two pixels are connected if they have common side. Each pixel in the interior of image has 4 connected pixels.

Picture in input has simple format — BMP picture with 24bit color, no compression used.

Samples of programs, working with such BMP pictures

Input Read from standard input BMP file. It's size less than 2 Mbytes. Height and width of the picture less than 1025.

Output Output to standard output number of segments.

PS:
Redirecting binary file to standard input works properly in Linux. If you use Windows then read from file while debugging your program. But before submiting change input stream(file) to standard input.

Input#1

Output#1
15

Author:
Pasha Agapov & Fedya Chelnokov

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 200ms

SW soft NIX
ID = 54.144.21.195