PROBLEM D | MAX GEQ SUM

Правка en1, от piyush1_1_23, 2022-06-08 07:30:25

for (int i = 0; i < n; i++) { ** ll rightMax = query(prefixTree, 1, 0, _n — 1, i + 1, ng[i] — 1) — prefixSum[i];** ** ll leftMax = query(suffixTree, 1, 0, _n — 1, pg[i] + 1, i — 1) — suffixSum[i];** ** if (max(leftMax, rightMax) > 0) {** ** flag = false;** ** break;** ** }** ** }**

why they are selecting the lower index as i + 1 but not i. According to me it was something like

ll rightMax = query(prefixTree, 1, 0, _n — 1, i, ng[i] — 1) — prefixSum[i-1];**

Теги codeforces, contest-1691

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский piyush1_1_23 2022-06-08 07:35:24 123
en2 Английский piyush1_1_23 2022-06-08 07:32:49 73
en1 Английский piyush1_1_23 2022-06-08 07:30:25 645 Initial revision (published)