1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
//Functions were here
int main()
{
cout<<"A";
ifstream ifile;
ifile.open("rmq_data.txt");
int x, y=0, i, j, n, m;
ifile>>n;
int A[n];
double d=(log(n)/log(2));
m=floor(d)+1;
x=n*m;
int AP[x];
cout<<"B";
while(ifile.good())
{
ifile>>x;
A[y]=x;
y++;
}
ifile.close();
for(i=0; i<y; i++)
{
for(j=0; (i+pow(2,j))<y; j++)
//{ AP[i*m+j]=RMQs(i, (i+pow(2,j)), A); }
}
cout<<"C";
ifile.open("rmq_op.txt");
ofstream out0, out1, out2;
out0.open("rmq0_result.txt");
out1.open("rmq1_result.txt");
out2.open("rmq2_result.txt");
int L, R, s1, s2;
cout<<"D";
while(ifile.good())
{
ifile>>L>>R>>s1>>s2;
/*
out0<<RMQ0(L,R,m,A,AP)<<endl;
out1<<RMQ1(L,R,s1,m,A,AP)<<endl;
out2<<RMQ2(L,R,s1,s2,m,A,AP)<<endl;
cout<<"E";
*/
}
return 0;
}
 