Блог пользователя ZengDingjun_EggArmy

Автор ZengDingjun_EggArmy, история, 4 часа назад, По-английски

Hello CodeForces community!

I noticed that some greedy problems are used in passed Div.2 as problem A/B have very large limits like $$$n \ge 10^5$$$, is not friendly for coders who don't know sorting skills.

Why? I think we should let all sorting algorithm pass these problems, including the following code:

vector<int> Sort(vector<int> x){
    vector<int> rnk(x.size());
    iota(rnk.begin(),rnk.end(),0);
    do{
        if(is_sorted(rnk.begin(),rnk.end(),[&](int a,int b){return x[a]<x[b];})) break;
    }while(next_permutation(rnk.begin(),rnk.end()));
    vector<int> res;
    for(auto id:rnk) res.push_back(x[id]);
    return res;
}

So I advise that we should let these problems' limits less than $$$8$$$.

Thanks, please upvote this.

Z.

  • Проголосовать: нравится
  • -23
  • Проголосовать: не нравится

»
4 часа назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

You should change the function's name to "joker_sort".