#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <set>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
struct A
{
int x;
A( int _x ) : x(_x) { }
};
struct B
{
int x;
B( int _x ) : x(_x) { }
};
struct D
{
int x;
D( int _x ) : x(_x) { }
};
inline bool operator < ( const A &u, const A &v ) { return u.x > v.x; }
struct BLess
{
inline bool operator() ( const B &u, const B &v ) { return u.x > v.x; }
};
inline bool DLess( const D &u, const D &v ) { return u.x > v.x; }
const int n = (int)1e6;
int x[n];
typedef bool (*func)( const D &u, const D &v );
set <A> a;
set <B, BLess> b;
set <int> c;
set <D, func> d(DLess);
int R()
{
return (rand() << 15) ^ rand();
}
void gen()
{
for (int i = 0; i < n; i++)
x[i] = R();
}
int main()
{
double start;
printf("n = %d\n", n);
gen();
start = clock();
forn(i, n)
a.insert(x[i]);
printf("%.2f [%d..%d] struct with operator <\n", (clock() - start) / CLOCKS_PER_SEC, a.begin()->x, a.rbegin()->x);
start = clock();
forn(i, n)
b.insert(x[i]);
printf("%.2f [%d..%d] struct with operator ()\n", (clock() - start) / CLOCKS_PER_SEC, b.begin()->x, b.rbegin()->x);
start = clock();
forn(i, n)
c.insert(x[i]);
printf("%.2f [%d..%d] just int\n", (clock() - start) / CLOCKS_PER_SEC, *c.begin(), *c.rbegin());
start = clock();
forn(i, n)
d.insert(x[i]);
printf("%.2f [%d..%d] template less function\n", (clock() - start) / CLOCKS_PER_SEC, d.begin()->x, d.rbegin()->x);
return 0;
}