compro-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub ningenMe/compro-library

:heavy_check_mark: Argument - 偏角
(lib/70-geometory/Argument.cpp)

Verified with

Code

/*
 * @title Argument - 偏角
 * @docs md/geometory/Argument.md
 */
class Argument {
public:
    template<class T> inline static vector<int> sort_by_atan2l(vector<pair<T,T>> points){
        int N = points.size();
        vector<long double> arg(N);
        for(int i = 0; i < N; ++i) arg[i] = atan2l(points[i].second,points[i].first);
        vector<int> res(N);
        iota(res.begin(),res.end(),0);
        sort(res.begin(),res.end(),[&](int l,int r){return arg[l] < arg[r];});
        return res;
    }
};
#line 1 "lib/70-geometory/Argument.cpp"
/*
 * @title Argument - 偏角
 * @docs md/geometory/Argument.md
 */
class Argument {
public:
    template<class T> inline static vector<int> sort_by_atan2l(vector<pair<T,T>> points){
        int N = points.size();
        vector<long double> arg(N);
        for(int i = 0; i < N; ++i) arg[i] = atan2l(points[i].second,points[i].first);
        vector<int> res(N);
        iota(res.begin(),res.end(),0);
        sort(res.begin(),res.end(),[&](int l,int r){return arg[l] < arg[r];});
        return res;
    }
};
Back to top page