Cod sursa(job #3362320)
| Utilizator | Data | 6 august 2026 12:26:06 | |
|---|---|---|---|
| Problema | Cbinteractiv | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.73 kb |
/*
https://www.infoarena.ro/problema/ssm
*/
#include <fstream>
#include <climits>
using namespace std;
int main()
{
ifstream in("ssm.in");
ofstream out("ssm.out");
int n, sc = -1, p, smax = INT_MIN, stmax, drmax;
in >> n;
for (int i = 0; i < n; i++)
{
int x;
in >> x;
if (x > sc + x)/// 0 > sc
{
sc = x;
p = i;
}
else
{
sc += x;
}
if (sc > smax)
{
smax = sc;
stmax = p;
drmax = i;
}
}
stmax++;
drmax++;
out << smax << " " << stmax << " " << drmax << endl;
in.close();
out.close();
return 0;
}
