Click Here to go back to the homepage.

Hot Hike Solution:


#include <bits/stdc++.h>

using namespace std;

int main(){
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int days;
    cin >> days;
    vector<int> temps;
    while(days--){
        int temp;
        cin >> temp;
        temps.push_back(temp);
    }
    int d = 0, min = INT_MAX;
    for(int i = 0; i < temps.size() - 2; i++){
        int temp = max(temps[i], temps[i+2]);
        if(temp < min){
            min = temp;
            d = i + 1;
        }
    }
    cout << d << " " << min;
    
    
    return 0;
}