Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions library/data_structures/deque_op/deque.hpp

This file was deleted.

4 changes: 0 additions & 4 deletions library/data_structures/deque_op/index.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,30 @@ template<class T, class F> struct deq {
if (empty(r)) return l.back()[1];
return op(l.back()[1], r.back()[1]);
}
int siz() { return sz(l) + sz(r); }
T operator[](int i) {
return (
i < sz(l) ? l[sz(l) - i - 1] : r[i - sz(l)])[0];
}
T front() { return (empty(l) ? r[0] : l.back())[0]; }
T back() { return (empty(r) ? l[0] : r.back())[0]; }
int siz() { return sz(l) + sz(r); }
void push_back(T elem) {
r.push_back(
{elem, empty(r) ? elem : op(r.back()[1], elem)});
}
void pop_back() {
if (empty(r)) {
vector<T> a(sz(l));
transform(all(l), rbegin(a),
[](dt& x) { return x[0]; });
rebuild(a, sz(a) / 2);
}
r.pop_back();
}
void push_front(T elem) {
l.push_back(
{elem, empty(l) ? elem : op(elem, l.back()[1])});
}
void pop_front() {
if (empty(l)) {
vector<T> a(sz(r));
Expand All @@ -29,10 +50,6 @@ template<class T, class F> struct deq {
}
l.pop_back();
}
void push_back(T elem) {
r.push_back(
{elem, empty(r) ? elem : op(r.back()[1], elem)});
}
void rebuild(const vector<T>& a, int sz_le) {
vector<T> presum(sz(a));
partial_sum(rend(a) - sz_le, rend(a),
Expand All @@ -46,6 +63,4 @@ template<class T, class F> struct deq {
transform(sz_le + all(a), begin(presum) + sz_le,
begin(r), [](T x, T y) { return dt{x, y}; });
}
#include "deque.hpp"
#include "index.hpp"
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define PROBLEM \
"https://onlinejudge.u-aizu.ac.jp/courses/lesson/8/ITP2/all/ITP2_1_B"
#include "../template.hpp"
#include "../../../library/data_structures/deque_op/queue_only.hpp"
#include "../../../library/data_structures/uncommon/deque_op.hpp"
int main() {
cin.tie(0)->sync_with_stdio(0);
int q;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"https://judge.yosupo.jp/problem/deque_operate_all_composite"
#include "../template.hpp"
#include "../../../library/contest/random.hpp"
#include "../../../library/data_structures/deque_op/queue_only.hpp"
#include "../../../library/data_structures/uncommon/deque_op.hpp"
int main() {
cin.tie(0)->sync_with_stdio(0);
const int mod = 998'244'353;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define PROBLEM \
"https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/all/DSL_3_D"
#include "../template.hpp"
#include "../../../library/data_structures/deque_op/queue_only.hpp"
#include "../../../library/data_structures/uncommon/deque_op.hpp"
int mn(int x, int y) { return min(x, y); }
int main() {
cin.tie(0)->sync_with_stdio(0);
Expand Down
1 change: 1 addition & 0 deletions tests/scripts/build_pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rm ../library/data_structures/seg_tree_uncommon/implicit.hpp || exit 1
rm ../library/data_structures/seg_tree_uncommon/kth_smallest_query.hpp || exit 1
rm ../library/data_structures/uncommon/mode_query.hpp || exit 1
rm ../library/data_structures/uncommon/priority_queue_of_updates.hpp || exit 1
rm ../library/data_structures/uncommon/deque_op.hpp || exit 1
rm ../library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp || exit 1
rm ../library/graphs/strongly_connected_components/offline_incremental_scc.hpp || exit 1
rm ../library/graphs/uncommon/bridges.hpp || exit 1
Expand Down
Loading