PROBLEM D | MAX GEQ SUM

Revision en1, by 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];**

Tags codeforces, contest-1691

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English piyush1_1_23 2022-06-08 07:35:24 123
en2 English piyush1_1_23 2022-06-08 07:32:49 73
en1 English piyush1_1_23 2022-06-08 07:30:25 645 Initial revision (published)