#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
std::vector<int> v = {2, 1, 3, 6, 7, 9, 8};
auto it = std::minmax_element(v.begin(), v.end());
int min_idx = std::distance(v.begin(), it.first);
int max_idx = std::distance(v.begin(), it.second);
std::cout << min_idx << ", " << max_idx << std::endl; // 1, 5
return 0;
}