Heaps

#include
#include
using namespace std;
vector v; 
int M,N;
void postOrder(int index){
	if(index>=N) return;
	postOrder(2*index+1);
	postOrder(2*index+2);
	printf("%d%s",v[index],index==0?"\n":" ");
} 
int main(){
	scanf("%d%d",&M,&N);
	v.resize(N);
	for(int i=0;iv[1]?1:-1;
		for(int j=0;jv[left]||v[j]>v[right])&&flag==-1)||((v[j]

 

你可能感兴趣的:(PAT,甲级)