#include <iostream>
using namespace std;
int divideEtConquer(int vec[], int left, int right) {
int m;
if(left == right) {
return vec[ left ];
} else {
int a, b;
m = (left + right)>>1;
a = divideEtConquer(vec, left, m);
b = divideEtConquer(vec, m + 1, right);
if(a < b) return a;
else
return b;
}
}
int main(int argc, char const *argv[]) {
int vec[] = {44,22,99,100,101,-19,17,0,1,2,3},
n = sizeof(vec)/sizeof(vec[0]),
max;
max = divideEtConquer(vec, 0, n - 1);
cout<<max;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGRpdmlkZUV0Q29ucXVlcihpbnQgdmVjW10sIGludCBsZWZ0LCBpbnQgcmlnaHQpIHsKICAgIGludCBtOwogICAgaWYobGVmdCA9PSByaWdodCkgewogICAgICAgICAgICAgICByZXR1cm4gdmVjWyBsZWZ0IF07CiAgICB9IGVsc2UgewogICAgICAgICBpbnQgYSwgYjsKICAgICAgICAgbSA9IChsZWZ0ICsgcmlnaHQpPj4xOwogICAgICAgICBhID0gZGl2aWRlRXRDb25xdWVyKHZlYywgbGVmdCwgbSk7CiAgICAgICAgIGIgPSBkaXZpZGVFdENvbnF1ZXIodmVjLCBtICsgMSwgcmlnaHQpOwogICAgICAgICBpZihhIDwgYikgcmV0dXJuIGE7CiAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgIHJldHVybiBiOwogICAgfQp9CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciBjb25zdCAqYXJndltdKSB7CgogICAgaW50IHZlY1tdID0gezQ0LDIyLDk5LDEwMCwxMDEsLTE5LDE3LDAsMSwyLDN9LAogICAgbiA9IHNpemVvZih2ZWMpL3NpemVvZih2ZWNbMF0pLAogICAgbWF4OwogICAgbWF4ID0gZGl2aWRlRXRDb25xdWVyKHZlYywgMCwgbiAtIDEpOwogICAgY291dDw8bWF4OwoKICByZXR1cm4gMDsKfQ==