matsueushi

AtCoder AGC 023 A - Zero-Sum Ranges

競プロ    AtCoder
2022-6-13 21:26

https://atcoder.jp/contests/agc023/tasks/agc023_a

\(C_j = \sum_{k=1}^j A_k\) とおくと、 \(\sum_{k=i}^j A_k = 0 \Leftrightarrow C_j = C_{k-1}\) であるから、 累積和を求めて \(C_0=0, C_j = \sum_{k=1}^j A_k\) とおき、 \(I_x = \{ i \mid C_i = x\}\) を計算して、\(\sum_x |I_x| (|I_x|-1)/2\) を求めれば良い。

https://atcoder.jp/contests/agc023/submissions/32455933

  • Home
  • Blog
  • BOaT
  • NATSUMEN
  • Playlist
  • Other
  • AtCoder
  • Categories
  • Tags
  • Search
  • About
Copyright © 2019–2025
Built with Hugo and theme Tokiwa. 73 words in this page.

AtCoder ABC 255 C - ±1 Operation 1 AtCoder ABC 147 D - Xor Sum 4
Related AtCoder ABC 255 C - ±1 Operation 1   /  AtCoder ABC 255 D - ±1 Operation 2  /  AtCoder ABC 255 E - Lucky Numbers  /  AtCoder diverta 2019 Programming Contest D - DivRem Number  /  AtCoder APC 001 B - Two Arrays  /  AtCoder ABC 198 D - Send More Money  /  AtCoder ABC 129 D - Lamp  /  AtCoder ABC 153 E - Crested Ibis vs Monster  /  AtCoder ABC 161 D - Lunlun Number  /  AtCoder CODE FESTIVAL 2017 qualC C - Inserting 'x'  /  AtCoder ABC 034 A - Kenken Race  /  AtCoder AGC 011 B - Colorful Creatures  /  AtCoder ABC 134 D - Preparing Boxes  /  AtCoder ABC 064 D - Insertion  /  AtCoder ABC 133 D - Rain Flows into Dams

comments powered by Disqus