i am getting WA in test 3, probably missing some case that i did not include in my code, but i am unable to find what case i am missing (i am missing brain ofc but what else).

Before contest

Codeforces Round sponsored by NEAR (Div. 1 + Div. 2)

3 days

Register now »

Codeforces Round sponsored by NEAR (Div. 1 + Div. 2)

3 days

Register now »

*has extra registration

# | User | Rating |
---|---|---|

1 | tourist | 3803 |

2 | jiangly | 3707 |

3 | Benq | 3627 |

4 | ecnerwala | 3584 |

5 | orzdevinwang | 3573 |

6 | Geothermal | 3569 |

6 | cnnfls_csy | 3569 |

8 | Radewoosh | 3542 |

9 | jqdai0815 | 3532 |

10 | gyh20 | 3447 |

# | User | Contrib. |
---|---|---|

1 | awoo | 162 |

2 | maomao90 | 160 |

3 | adamant | 157 |

4 | maroonrk | 154 |

5 | -is-this-fft- | 150 |

6 | Petr | 148 |

6 | SecondThread | 148 |

8 | atcoder_official | 147 |

9 | TheScrasse | 145 |

9 | nor | 145 |

i am getting WA in test 3, probably missing some case that i did not include in my code, but i am unable to find what case i am missing (i am missing brain ofc but what else).

↑

↓

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/15/2024 21:41:44 (k2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

I think you misunderstood the statement, you don't need the number of ways to make $$$c \equiv k \mod 998244353$$$, you need the number of ways to maximize $$$c$$$. Since the number of ways is big (not the maximum value of $$$c$$$), you want that number $$$\mod 998244353$$$.

yeah but like even if i do only (number of way to maximize c) % MOD

like here:

the number of ways to maximize c depends on count1 and count2, so i am doing % MOD to them only. and isn't, the number of ways to make c=k is equal to the number of ways to maximize c? like k is the maximum value right?

Ok, I found a failing testcase:

$$$n = 2$$$

$$$arr_0 = -1, arr_1 = 0$$$

Your code outputs $$$3$$$, but the answer is $$$2$$$.

how is it 2,

like here k is 1;

and we have 3 ways;

1st : c = c+arr0 = -1 , c = |c+arr1| = 1

2nd : c = |c+arr0| = 1 , c = c+arr1 = 1

3rd : c = |c+arr0| = 1 , c = |c+arr1| = 1;

there are 3 unique ways to maximize c

My bad

Auto comment: topic has been updated by butterpaneer (previous revision, new revision, compare).