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
57
58
59
60
61
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    vector<int> oceny;
    int pom;
    cin>>n;
    long maxfc = 2*n+1;
    long fc;
    long result =0;
    oceny.resize(n+1);

    for(int i=1;i<=n;++i)
    {
        cin>>pom;
        oceny[i] = pom;
    }

    for(int l=1;l<=n;++l)
    {
        for(int r=n;r>=1;--r)
        {
            if(r>l)
            {
                if((r-l+1)%2 == 0)
                {

                    fc = oceny[(r-l+1)/2]+oceny[(r-l+1)/2+1] +(r-l+1);
                }
                else
                {
                    fc = 2*oceny[(r-l+1)/2] +(r-l+1);
                }
            }
            else
            {
                if((l-r+1)%2 == 0)
                {

                    fc = oceny[(l-r+1)/2]+oceny[(l-r+1)/2+1] +(l-r+1);
                }
                else
                {
                    fc = 2*oceny[(l-r+1)/2] +(l-r+1);
                }
            }

            if(maxfc == fc) result++;
        }
    }

    cout<<maxfc<<" "<<++result;
    

    return 0;
}