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

Show all messages Hide all messages

this is a shape of sample#1: ('B'=Black, '.'=white)
B...B
.B...
..B..

you must count all the streak which not belong to the streak with size more than current streak, therefor the cell's (1,2) & (2,1) & (3,2) must'nt count because they are belong to streak (1,2)->(1,4) & (2,1)->(2,2) & (3,1)->(3,2).

here some test for problem:
//////////////////////////
input:
5 5 2
1 2
3 3

output:
12
//////////////////////////
input:
5 5 4
1 2
5 3
3 1
4 4

output:
12
//////////////////////////
input:
1 1 0

output:
1
//////////////////////////
input:
1 1 1
1 1

output:
0
/////////////////////////
input:
5 5 12
1 2
1 4
2 1
2 3
2 5
3 2
3 4
4 1
4 3
4 5
5 2
5 4

output:
13
//////////////////////////////
I hope can help you.
GOOD LUCK!
Re: some explain about sample#1 & some test SazanovSasha 27 Sep 2013 12:44
I don't understand

this is a shape of sample#1: ('B'=Black, '.'=white)
B...B
.B...
..B..

I see 7 sreaks:
1) (2,1)->(3,1)
2) (3,1)->(3,2)
3) (1,2)->(1,4)
4) (2,3)->(2,5)
5) (1,4)->(3,4)
6) (3,4)->(3,5)
7) (2,5)->(3,5)

why 8!?
+(1,3)-->(2,3)
i think...
Edited by author 28.12.2013 04:11

Edited by author 28.12.2013 04:55