Cod sursa(job #2055604)

Utilizator giotoPopescu Ioan gioto Data 3 noiembrie 2017 15:20:00
Problema Rsir Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <bits/stdc++.h>
using namespace std;

int n, a[1000005];
int main()
{
    freopen("sushi.in", "r", stdin);
    freopen("sushi.out", "w", stdout);
    scanf("%d", &n);
    int x, Max = 0, pos = 0;
    for(int i = 1; i <= n ; ++i){
        scanf("%d", &a[i]);
        if(a[i] > Max) Max = a[i], pos = i;
    }
    int r = pos;
    while(a[r + 1] == Max) ++r;
    printf("%d %d %d", pos, r, Max * 2);
    return 0;
}