Problem Link: https://www.codechef.com/DWWU2019/problems/DWW19I

My solution: https://www.codechef.com/viewsolution/28587531

Problem Link: https://www.codechef.com/DWWU2019/problems/DWW19I

My solution: https://www.codechef.com/viewsolution/28587531

Here is a test case that your code fails on:-

1

1

3

1 Like

Actually N can also be 1, which you aren’t assuming. I think you missed the constraints. Your code assumes N \ge 2. So consider this case:

N = 1, A_{1} = 43 (Assuming 1-indexed representation)

Your Code Prints:

```
1 1
```

Correct Output:

```
43 1
```

Hope it helps!

Cheers!

Happy Programming!

1 Like

Line 19 is wrong.

1 Like

Thanks. Very silly mistake on my part