NO COPYING!
NO COPYING!
NO COPYING!
//Sinhaeng Hhjian
#include
#define inf 0x3f3f3f3f
#define MAX 100
using namespace std;
const int maxn=1005;
struct node{
int num, v, f, ls, rs;
}tree[4*maxn];
int st[maxn];
struct Queue{
node *base;
int f, r;
};
void InitQueue(Queue &q){
q.base = (node *)malloc(sizeof(node) * MAX);
q.f = q.r = 0;
}
void InQueue(Queue &q, node bt){
q.base[q.r++] = bt;
}
int IsEmpty(Queue q){
return q.f == q.r? 1:0;
}
void OutQueue(Queue &q, node &bt){
if(IsEmpty(q)) return ;
bt = q.base[q.f++];
}
int judge(int n){
int sum=0;