Hello, I got stuck here in this problem from cses Subarray Divisibility.I know that showing solutions is prohibited from cses but still I need some help here.My solution is here.Plz don't down vote me.If u can't help me just ignore this topic.

Before contest

Codeforces Round #680 (Div. 1, based on Moscow Team Olympiad)

09:42:58

Register now »

Codeforces Round #680 (Div. 1, based on Moscow Team Olympiad)

09:42:58

Register now »

*has extra registration

Before contest

Codeforces Round #680 (Div. 2, based on Moscow Team Olympiad)

09:42:57

Register now »

Codeforces Round #680 (Div. 2, based on Moscow Team Olympiad)

09:42:57

Register now »

*has extra registration

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

1 | tourist | 3619 |

2 | Um_nik | 3493 |

3 | ecnerwala | 3446 |

4 | Radewoosh | 3383 |

5 | ksun48 | 3357 |

6 | yosupo | 3324 |

7 | Benq | 3299 |

8 | maroonrk | 3243 |

9 | apiadu | 3238 |

10 | Petr | 3217 |

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

1 | Errichto | 207 |

2 | Monogon | 196 |

2 | SecondThread | 196 |

4 | vovuh | 188 |

5 | pikmike | 186 |

6 | antontrygubO_o | 185 |

6 | Um_nik | 185 |

8 | Ashishgup | 182 |

9 | pashka | 169 |

10 | Radewoosh | 167 |

Hello, I got stuck here in this problem from cses Subarray Divisibility.I know that showing solutions is prohibited from cses but still I need some help here.My solution is here.Plz don't down vote me.If u can't help me just ignore this topic.

↑

↓

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Nov/01/2020 04:22:03 (h3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

My approach to this problem would be to calculate a prefix sum mod N. This gives N possible values for each prefix sum. Count the number of occurrences of each prefix sum and then do the sum of those numbers choose 2. This problem is very similar to http://usaco.org/index.php?page=viewproblem2&cpid=595

Thanks

straight forward answer has geeks for geeks for this. Here is the link for this