题目描述
思路:
离线处理,从所有边都切完后在做。
用h把上一条线和下一条和到左边线的距离存下来,然后每次加进来就相当于把边删去。
c o d e code code
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
const int MAXN = 2e5 + 10;
int w1, h1, n;
bool vh[MAXN], vw[MAXN];
ll ans[MAXN];
struct node {
int nxt, lst, val;
}h[MAXN], w[MAXN];
struct abc {
char c;
int x;
}a[MAXN];
int main