二维前缀和的正确姿势

来自一个前缀和写错选手的良心馈赠

inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}
inline int get_sum(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] + sum[x1 - 1][y1 - 1] - sum[x2][y1 - 1] - sum[x1 - 1][y2];
}

发表评论

电子邮件地址不会被公开。必填项已用 * 标注