关联查询优化
1.准备工作
CREATE TABLE IF NOT EXISTS type(id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,card INT(10) UNSIGNED NOT NULL,PRIMARY KEY(id));CREATE TABLE IF NOT EXISTS book(
bookid INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
card INT(10) UNSIGNED N…
代码:
#include <iostream>
#include <algorithm>
#include <string.h>using namespace std;const int N 100010;int h[N], hp[N], ph[N], cnt;void heap_swap(int a, int b)
{swap(ph[hp[a]] ,ph[hp[b]]);swap(hp[a], hp[b]);swap(h[a], h[b])…