#include <iostream>
#include <utility>
#include <algorithm>
std::vector< std::pair<double,double> > unoccupied( const std::vector<double>& seq )
{
constexpr double multiplier_after = 1.10 ;
constexpr double multiplier_before = 0.90 ;
std::vector< std::pair<double,double> > result ;
if( seq.size() > 1 && std::is_sorted( std::begin(seq), std::end(seq) ) )
{
double prev = seq.front() * multiplier_after ;
for( auto iter = ++std::begin(seq) ; iter != std::end(seq) ; ++iter )
{
double curr = *iter * multiplier_before ;
if( curr > prev ) result.emplace_back( prev, curr ) ;
prev = *iter * multiplier_after ;
}
}
return result ;
}
int main()
{
for( const auto& p : unoccupied( { 2.0, 2.1, 2.13, 2.2, 3.5, 3.6, 3.9, 6.4, 7.0 } ) )
std::cout << '[' << p.first << '-' << p.second << "] " ;
std::cout << '\n' ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPGFsZ29yaXRobT4KCnN0ZDo6dmVjdG9yPCBzdGQ6OnBhaXI8ZG91YmxlLGRvdWJsZT4gPiB1bm9jY3VwaWVkKCBjb25zdCBzdGQ6OnZlY3Rvcjxkb3VibGU+JiBzZXEgKQp7CiAgICBjb25zdGV4cHIgZG91YmxlIG11bHRpcGxpZXJfYWZ0ZXIgPSAxLjEwIDsKICAgIGNvbnN0ZXhwciBkb3VibGUgbXVsdGlwbGllcl9iZWZvcmUgPSAwLjkwIDsKCiAgICBzdGQ6OnZlY3Rvcjwgc3RkOjpwYWlyPGRvdWJsZSxkb3VibGU+ID4gcmVzdWx0IDsKCiAgICBpZiggc2VxLnNpemUoKSA+IDEgJiYgc3RkOjppc19zb3J0ZWQoIHN0ZDo6YmVnaW4oc2VxKSwgc3RkOjplbmQoc2VxKSApICkKICAgIHsKICAgICAgICBkb3VibGUgcHJldiA9IHNlcS5mcm9udCgpICogbXVsdGlwbGllcl9hZnRlciA7CiAgICAgICAgZm9yKCBhdXRvIGl0ZXIgPSArK3N0ZDo6YmVnaW4oc2VxKSA7IGl0Z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