You are not logged in. Please login at www.codechef.com to post your questions!

×

SPOJ MSE06H

http://www.spoj.com/problems/MSE06H/

https://github.com/cacophonix/SPOJ/blob/master/MSE06H.cpp

Can anyone explain the logic of
for(i = k-1; i >= 0; i = j) {
for(j = i; j >= 0 && roads[j].u == roads[i].u; j--) res += read(roads[j].v - 1);
for(j = i; j >= 0 && roads[j].u == roads[i].u; j--) add(roads[j].v, 1);
} Why are the innermost for loops used
The 2nd and the 3rd for loops??

asked 31 Dec '14, 13:05

abeyaar's gravatar image

1★abeyaar
33422140
accept rate: 30%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,136
×146

question asked: 31 Dec '14, 13:05

question was seen: 2,374 times

last updated: 31 Dec '14, 13:05