summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/other/pbs.cpp11
-rw-r--r--tcr.pdfbin691903 -> 691692 bytes
2 files changed, 6 insertions, 5 deletions
diff --git a/content/other/pbs.cpp b/content/other/pbs.cpp
index 5508d6c..6cf872a 100644
--- a/content/other/pbs.cpp
+++ b/content/other/pbs.cpp
@@ -1,10 +1,11 @@
// Q = # of queries, bucket sort is sometimes faster
-vector<int> low(Q, 0), high(Q, MAX_OPERATIONS);
+vector<int> low(Q, 0), high(Q, MAX_OPERATIONS + 1);
while (true) {
vector<pair<int, int>> focus;
- for (int i = 0; i < Q; i++) if (low[i] < high[i]) {
- focus.emplace_back((low[i] + high[i]) / 2, i);
- }
+ for (int i = 0; i < Q; i++) {
+ if (low[i] + 1 < high[i]) {
+ focus.emplace_back((low[i] + high[i]) / 2, i);
+ }}
if (focus.empty()) break;
sort(all(focus));
@@ -14,5 +15,5 @@ while (true) {
// simulation step
}
if (/* requirement already fulfilled */) high[i] = mid;
- else low[i] = mid + 1;
+ else low[i] = mid;
}} // answer in low (and high)
diff --git a/tcr.pdf b/tcr.pdf
index c6fc0ce..e349ca0 100644
--- a/tcr.pdf
+++ b/tcr.pdf
Binary files differ