feat: misc cleanups
This commit is contained in:
parent
24685b693c
commit
20ca76756e
3 changed files with 1 additions and 9 deletions
|
|
@ -5,7 +5,6 @@ std::vector<int> maximumBeauty(std::vector<std::vector<int>>& items, std::vector
|
||||||
std::sort(items.begin(), items.end());
|
std::sort(items.begin(), items.end());
|
||||||
std::vector<std::pair<int, int>> sorted_queries;
|
std::vector<std::pair<int, int>> sorted_queries;
|
||||||
sorted_queries.reserve(queries.size());
|
sorted_queries.reserve(queries.size());
|
||||||
// couple queries with their indices
|
|
||||||
for (size_t i = 0; i < queries.size(); ++i) {
|
for (size_t i = 0; i < queries.size(); ++i) {
|
||||||
sorted_queries.emplace_back(queries[i], i);
|
sorted_queries.emplace_back(queries[i], i);
|
||||||
}
|
}
|
||||||
|
|
@ -20,9 +19,8 @@ std::vector<int> maximumBeauty(std::vector<std::vector<int>>& items, std::vector
|
||||||
beauty = std::max(beauty, items[i][1]);
|
beauty = std::max(beauty, items[i][1]);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
// invariant: items[i - 1] is the rightmost considerable item
|
|
||||||
ans[index] = i > 0 && items[i - 1][0] <= query ? beauty : 0;
|
ans[index] = i > 0 && items[i - 1][0] <= query ? beauty : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(ans);
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ long long minEnd(int n, long long x) {
|
||||||
|
|
||||||
while (bits_to_distribute > 0) {
|
while (bits_to_distribute > 0) {
|
||||||
if ((x & mask) == 0) {
|
if ((x & mask) == 0) {
|
||||||
// if the bit should be set, set it-otherwise, leave it alone
|
|
||||||
if ((bits_to_distribute & 1) == 1)
|
if ((bits_to_distribute & 1) == 1)
|
||||||
x |= mask;
|
x |= mask;
|
||||||
bits_to_distribute >>= 1;
|
bits_to_distribute >>= 1;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
const TERMINAL_PROMPT = "barrett@ruth:~$ ";
|
const TERMINAL_PROMPT = "barrett@ruth:~$ ";
|
||||||
let clearing = false;
|
let clearing = false;
|
||||||
|
|
||||||
// Define the Header component
|
|
||||||
class SiteHeader extends HTMLElement {
|
class SiteHeader extends HTMLElement {
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
const path = window.location.pathname;
|
const path = window.location.pathname;
|
||||||
|
|
@ -40,7 +39,6 @@ class SiteHeader extends HTMLElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define the Footer component
|
|
||||||
class SiteFooter extends HTMLElement {
|
class SiteFooter extends HTMLElement {
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
this.innerHTML = `
|
this.innerHTML = `
|
||||||
|
|
@ -56,13 +54,10 @@ class SiteFooter extends HTMLElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the custom elements
|
|
||||||
customElements.define("site-header", SiteHeader);
|
customElements.define("site-header", SiteHeader);
|
||||||
customElements.define("site-footer", SiteFooter);
|
customElements.define("site-footer", SiteFooter);
|
||||||
|
|
||||||
// Add styles once when DOM is loaded
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
// Add dynamic styles if they don't exist
|
|
||||||
if (!document.querySelector("style#dynamic-styles")) {
|
if (!document.querySelector("style#dynamic-styles")) {
|
||||||
const style = document.createElement("style");
|
const style = document.createElement("style");
|
||||||
style.id = "dynamic-styles";
|
style.id = "dynamic-styles";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue