Friday the 13th, Programmers Day

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
345 Friday the 13th, Programmers Day FINISHED False 7200 397405185 Sept. 13, 2013, 3:40 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 83 ) D Chain Letter PROGRAMMING *special dfs and similar graphs 2300

A chain letter is a kind of a message which urges the recipient to forward it to as many contacts as possible, usually with some kind of mystic explanation. Of course, this is only a superstition, and you don't believe in it, but all your friends do. You know that today there will be one of these letters going around, and you want to know how many times you'll receive it — of course, not that you'll be sending it yourself! You are given an array of strings f with n elements which describes the contacts between you and n - 1 of your friends: j -th character of i -th string ( f i j ) is " 1 " if people i and j will send messages to each other, and " 0 " otherwise. Person 1 starts sending the letter to all his contacts; every person who receives the letter for the first time sends it to all his contacts. You are person n , and you don't forward the letter when you receive it. Calculate the number of copies of this letter you'll receive. The first line of the input contains an integer n (2 ≤ n ≤ 50) — the number of people involved. Next n following lines contain elements of f , strings of length n . Each character in f is either " 0 " or " 1 ". It's guaranteed that two following equations hold: f i j = f j i , f i i = 0, for all i , j (1 ≤ i , j ≤ n ) . Output a single integer — the number of copies of the letter you will receive eventually. In the first case, everybody sends letters to everyone, so you get copies from all three of your friends. In the second case, you don't know any of these people, so they don't bother you with their superstitious stuff. In the third case, two of your friends send you copies of the letter but the third friend doesn't know them so he is unaffected.

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
4453371 eatmore D Sept. 13, 2013, 5:06 p.m. OK Ada TESTS 32 0 0 2300
14875616 alishaterian D Dec. 19, 2015, 12:41 p.m. OK Ada TESTS 32 30 0 2300
14043267 130705009 D Nov. 3, 2015, 2:42 p.m. OK Ada TESTS 32 30 0 2300
5454277 Tohka D Dec. 17, 2013, 8:55 a.m. OK Ada TESTS 32 30 0 2300
5326026 Nechiz D Dec. 2, 2013, 6:18 a.m. OK Ada TESTS 32 30 0 2300
5323216 Nechiz D Dec. 1, 2013, 4:47 p.m. OK Ada TESTS 32 30 0 2300
5244271 PSDEV D Nov. 26, 2013, 3:09 p.m. OK Ada TESTS 32 30 0 2300
4547630 hza D Sept. 24, 2013, 8:44 a.m. OK Ada TESTS 32 30 0 2300
4478374 cuiaoxiang D Sept. 15, 2013, 3:14 p.m. OK Ada TESTS 32 30 0 2300
4454382 uwi D Sept. 13, 2013, 7:42 p.m. OK Ada TESTS 32 30 0 2300

remove filters

Back to search problems