struct myComp { bool operator() (const int &a, const int &b) { if (ac[a]<ac[b]) return a; else if (ac[a]==ac[b]&&pen[a]>=pen[b]) return a; return false; } }; set<int, myComp> s;