/*
*/
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
int vec[] = {1,2,5,-4,5,-6,7,1,-1,-7,1,10,1,-3,4},
n = sizeof(vec) / sizeof(vec[0]);
int smax, pmax, lmax, i, s, p = 1;
i = 0;
while(i < n) {
while(vec[i] <= 0 && i < n) i++;
s = 0;
p = i;
while(vec[i] >= 0 && i < n) {
s = s + vec[i];
i++;
}
if(s > smax) {
smax = s;
pmax = p;
lmax = i - p;
}
}
cout<<pmax<<"-"<<lmax<<"-"<<smax;
return 0;
}
LyoKCiovCiNpbmNsdWRlIDxpb3N0cmVhbT4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciBjb25zdCAqYXJndltdKSB7CgogICBpbnQgdmVjW10gPSB7MSwyLDUsLTQsNSwtNiw3LDEsLTEsLTcsMSwxMCwxLC0zLDR9LAoKICAgbiA9IHNpemVvZih2ZWMpIC8gc2l6ZW9mKHZlY1swXSk7CgogICBpbnQgc21heCwgcG1heCwgbG1heCwgaSwgcywgcCA9IDE7CgogICBpID0gMDsKCiAgIHdoaWxlKGkgPCBuKSB7CgogICAgICAgd2hpbGUodmVjW2ldIDw9IDAgJiYgaSA8IG4pIGkrKzsKCiAgICAgICBzID0gMDsKICAgICAgIHAgPSBpOwoKICAgICAgIHdoaWxlKHZlY1tpXSA+PSAwICYmIGkgPCBuKSB7CiAgICAgICAgIHMgPSBzICsgdmVjW2ldOwogICAgICAgICBpKys7CiAgICAgICB9CgogICAgICAgaWYocyA+IHNtYXgpIHsKICAgICAgICAgc21heCA9IHM7CiAgICAgICAgIHBtYXggPSBwOwogICAgICAgICBsbWF4ID0gaSAtIHA7CiAgICAgICB9CiAgIH0KICAgY291dDw8cG1heDw8Ii0iPDxsbWF4PDwiLSI8PHNtYXg7CgogIHJldHVybiAwOwp9Cg==