[题解](续II)Let’s Celebrate the 100th Contest on ZOJ! » ZOJ3441txt

ZOJ3441txt
ZOJ3441txt.c


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#define A malloc(sizeof(N))
#define B(a) _->a=a;
#define C (11259365^0xabcdef)
#define D(a,t,f) T(a,c(t,f),f)
#define E main
#define F I(int)
#define G getc(X)
#define H putc(C,std##out)
#define I int i
#define J p->i
#define K(a) for(;~ungetc(getc(X),X);a);
#define L() int
#define M N{int i;P;}
#define N struct Node
#define O (~-1)
#define P N*p
#define Q p->p
#define R(a) return(a);
#define S ungetc(i,X);assert(fscanf(X,"%d",&i)==1)
#define T(a,t,f) if(a)R(t)else R(f)
#define U !(i&2147483648U)
#define V void
#define W printf("%d%s",J,Q?" ":"");
#define X std##in
#define Y(a) if(!p)R(a)
#define Z if(i==C)R(O)else{S;R(c(i,r()))}

#ifndef __GNUC__
#error I want gcc!
#endif

;M;N*c(I,P){N*_=(N*)A;B(i)B(p)R(_)};
N*f(F,P){Y(O)D(i(J),J,f(i,Q))}N*m(F,
P){Y(O)R(c(i(J),m(i,Q)))}N*d(I,P){Y(
O)T(i^J,c(J,d(i,Q)),Q);}N*s(N*i,P){T
(p,s(d(J,i),Q),i)}N*r(){I=G;Z}L()w(P
){Y(H)W;R(w(Q))}L()u(I){R(U)}L()v(I)
{T(U,i,-i)};L()g(V){P=r();R(w(s(f(u,
p),m(v,r()))));}L()E(V){K(g())R(O)};
Leave a Reply