其实没有官方题解说的那么麻烦(>﹏<) 直接离线处理后 开个数组模拟下即可
砍当前树时 当左右的树被砍掉时 ans就--
都没被砍掉 ans就++
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#define scnaf scanf
#define cahr char
#define bug puts("bugbugbug");
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int mod=1000000007;
const int maxn=5e4+100;
const int inf=1e9;
inline void RDF(int &ret) { //输入为负数
char c;
int sgn;
while(c != '-' && (c < '0' || c > '9')) c = getchar();
sgn = (c == '-') ? -1 : 1;
ret = (c == '-') ? 0 : (c - '0');
while(c = getchar(), c >&