Cod sursa(job #1184321)

Utilizator Stefanescu_MihaiStefanescu Mihai-Nicolae Stefanescu_Mihai Data 12 mai 2014 10:48:54
Problema Arbori de intervale Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.81 kb
#include <fstream>

using namespace std;

#define MaxN 100100

int *v;

struct node
{
    int val, st, dr;
    node *pLeft, *pRight;
};

node *pRoot;

void CreateArb( node* pNode )
{
    if ( pNode->st == pNode->dr )
    {
        pNode->val = v[st];
        pNode->pLeft = NULL;
    }
    else
    {
        pNode->pLeft = new node;
        pNode->pLeft->st = st;
        pNode->pLeft->dr = ( st + dr ) / 2;
        pNode->pRight = new node;
        pNode->pRight->st = ( st + dr ) / 2 + 1;
        pNode->pRight->dr = dr;
    }
}

int main()
{
    ifstream f1( "arbint.in" );
    ofstream f2( "arbint.out" );

    int n, m, i;

    v = new int[n+1];

    f1 >> n >> m;

    for ( i = 1; i <= n; ++i )
        f1 >> v[i];

    pRoot->st = 1;
    pRoot->dr = n;

    return 0;
}