#include <iostream>
#include <set>
using namespace std;
int tab[100];
/******* way 1 ********/
struct comp1 {
bool operator()(const int &a, const int &b){
return tab[a] < tab[b];
}
};
void func1(){
set<int, comp1> S;
for(int i = 0; i < 11; i++) S.insert(i);
for(int val: S) printf("%d ", val);
printf("\n");
}
/******* way2 *********/
void func2(){
auto my_comp = [&](int a, int b)->bool {
return tab[a] < tab[b];
};
set<int, decltype(my_comp)> S(my_comp);
for(int i = 0; i < 11; i++) S.insert(i);
for(int val: S) printf("%d ", val);
printf("\n");
}
/**********************/
int main() {
for(int i = 0; i < 11; i++) tab[i] = (i*i*i) % 11;
func1();
func2();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c2V0Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IHRhYlsxMDBdOwoKCgovKioqKioqKiB3YXkgMSAqKioqKioqKi8KCnN0cnVjdCBjb21wMSB7Cglib29sIG9wZXJhdG9yKCkoY29uc3QgaW50ICZhLCBjb25zdCBpbnQgJmIpewoJCXJldHVybiB0YWJbYV0gPCB0YWJbYl07Cgl9Cn07Cgp2b2lkIGZ1bmMxKCl7CglzZXQ8aW50LCBjb21wMT4gUzsKCQoJZm9yKGludCBpID0gMDsgaSA8IDExOyBpKyspIFMuaW5zZXJ0KGkpOwoJZm9yKGludCB2YWw6IFMpIHByaW50ZigiJWQgIiwgdmFsKTsKCXByaW50ZigiXG4iKTsKfQoKCgovKioqKioqKiB3YXkyICoqKioqKioqKi8KCnZvaWQgZnVuYzIoKXsKCWF1dG8gbXlfY29tcCA9IFsmXShpbnQgYSwgaW50IGIpLT5ib29sIHsKCQlyZXR1cm4gdGFiW2FdIDwgdGFiW2JdOwoJfTsKCQoJc2V0PGludCwgZGVjbHR5cGUobXlfY29tcCk+IFMobXlfY29tcCk7CgkKCWZvcihpbnQgaSA9IDA7IGkgPCAxMTsgaSsrKSBTLmluc2VydChpKTsKCWZvcihpbnQgdmFsOiBTKSBwcmludGYoIiVkICIsIHZhbCk7CglwcmludGYoIlxuIik7Cn0KCgoKCi8qKioqKioqKioqKioqKioqKioqKioqLwoKaW50IG1haW4oKSB7Cglmb3IoaW50IGkgPSAwOyBpIDwgMTE7IGkrKykgdGFiW2ldID0gKGkqaSppKSAlIDExOwoJZnVuYzEoKTsKCWZ1bmMyKCk7CglyZXR1cm4gMDsKfQ==