手写双端队列 MLE 了,有什么不 MLE 的手写双端队列吗?
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#define MAXN 15000002
int k, n, a[MAXN];
struct Node {
int w, id;
};
struct deque {
Node dq[MAXN];
int head, tail;
void clear() {
memset(dq, 0, sizeof dq);
head = 1, tail = 0;
}
void pop_back() { --tail; }
void pop_front() { ++head; }
Node back() { return dq[tail]; }
Node front() { return dq[head]; }
bool empty() { return tail < head; }
void push(int x, int id) { dq[++tail].w = x, dq[tail].id = id; }
}que;