Want help in events program


Guy, please help me my program is showing correct output for example inputs and i have also tired some other inputs it is showing correct output.
I have put some comments also to help you understand the program better.
Please check it out

Try any L, R \geq 50 (or any large number, I think it has to be \geq 15 or something)

1 Like

(s)friday (e)monday (l)2 ®100
showing correct output but still answer is wrong

Yes, but make it L \geq 50 as I said and it’ll fail



thank for ur help, know i improvised my program but it still showing wrong answer.
Please help.

I have checked i program for these values and it showing correct answers.
sunday sunday 2 5
friday monday 6 100
sunday sunday 2 5
sunday sunday 6 10
saturday sunday 2 4
monday wednesday 1 20
saturday sunday 3 5

  1. if ne==ns no of days will be 1 and not 8
    2.if cnt(in ur prog ns)==1 u need to print smallest value of c greater than l and not c itself
    the ac version of ur code-
1 Like

thank you very much buddy…

in line 29 of your code,
else if(ne==ns)
c=8; //if starting day and ending day is same the gap is 8 days

for ne == ns, and c = ne - ns + 1,
c = 0 + 1 = 1 and not 8



please guy tell me the case where my program is wrong as for all the example input my output is correct.


5 2

1 4 4 4 4

your’s output: 5

answer: 4

5 3
5 5 5 2 2
your o/p-5
check editorial for explanations and clarifications