Exemplo n.º 1
0
void queryMax(int L,int R,int l,int r,int rt) {
	int mid;
	if (L<=l && r<=R) {
		maxx=max(maxx,ans1[rt]);
		return;
	}
	mid=(l+r)>>1;
	if (L<=mid) queryMax(L,R,Lson);
	if (R>mid) queryMax(L,R,Rson);
	return;
}
Exemplo n.º 2
0
int main(int argc, char const *argv[]) {
#ifdef LOCAL
    freopen("C:\\Users\\john\\Desktop\\in.txt","r",stdin);
    // freopen("C:\\Users\\john\\Desktop\\out.txt","w",stdout);
#endif
    int i;
	while(SII(n,k)==2) {
        build(1,n,1);

        for(i=1;i<=n-k+1;i++) {
        	minx=INF_INT;
        	queryMin(i,i+k-1,1,n,1);
        	printf("%d",minx);
        	if (i<n-k+1) printf(" ");
        	else printf("\n");
        }
        for(i=1;i<=n-k+1;i++) {
        	maxx=-INF_INT;
        	queryMax(i,i+k-1,1,n,1);
        	printf("%d",maxx);
        	if (i<n-k+1) printf(" ");
        	else printf("\n");
        }
	}
	return 0;
}
typeTable::typeTable(QString pLibelle)
{
    qDebug()<<"typeTable::typeTable(QString pLibelle)";
    QSqlQuery queryMax("SELECT MAX(numero)+1 FROM TYPETABLE");
    queryMax.first();
    int numeroTable=queryMax.value(0).toInt();
    QSqlQuery query("INSERT INTO TYPETABLE (numero,libelle) VALUES ("+QString::number(numeroTable)+",'"+pLibelle+"')");
    query.exec();    
    this->numero=numeroTable;
    this->libelle=pLibelle;
}